diff --git a/Commande.md b/Commande.md new file mode 100644 index 0000000000000000000000000000000000000000..2ec1d58beee1295f95c82676da22b32fff620f16 --- /dev/null +++ b/Commande.md @@ -0,0 +1,38 @@ +## Développement d'une ressource *pizza* + +### API et représentation des données + +| URI | Opération | MIME | Requête | Réponse | +| :-------------- | :---------- | :--------------------------------------------- | :-- | :---------------------------- | +| /commande | GET | <-application/json<br><-application/xml | | liste des commandes (C2) | +| /commande/{id} | GET | <-application/json<br><-application/xml | | une commande ou 404 | +| /commande/{id}/name | GET | <-text/plain | | le nom de l'acheteur ou 404 | +| /commande/{id}/pizzas| GET | <-text/plain | | la liste des pizas ou 404 | +| /commande | POST | <-/->application/json<br>->application/x-www-form-urlencoded | Commande(C2) | Nouvelle commande(C2)<br>409 si la commande existe déjà (même nom) | +| /commande/{id} | DELETE | | | | + + +Une commande comporte uniquement une liste des pizzas, un identifiant, un nom et un prénom. Sa +représentation JSON (C2) prendra donc la forme suivante : + + { + "id": "f38806a8-7c85-49ef-980c-149dcd81d450", + "nom": "Jean", + "prénom":"Paul" + [{[{"id":"f38806a8-7c85-49ef-980c-149dcd81d200", "nom":"Saumon"}], + "id": "f38806a8-7c85-49ef-980c-149dcd81d306", + "name": "Norvegienne"}], + } + +Lors de la création, l'identifiant n'est pas connu car il sera fourni +par le JavaBean qui représente une commande. Aussi on aura une +représentation JSON (C1) qui comporte uniquement le nom et le prénom et la liste des pizzas : + + { + "nom": "Jean", + "prénom":"Paul" + [{[{"id":"f38806a8-7c85-49ef-980c-149dcd81d200", "nom":"Saumon"}], + "id": "f38806a8-7c85-49ef-980c-149dcd81d306", + "name": "Norvegienne"}], + } + diff --git a/Pizza.md b/Pizza.md new file mode 100644 index 0000000000000000000000000000000000000000..937c190efb6968d85957136b624f1576f937d8fc --- /dev/null +++ b/Pizza.md @@ -0,0 +1,29 @@ + | Réponse | +| :--------------| :---------- | :--------------------------------------------- | :-- | :---------------------------- | +| /pizza | GET | <-application/json<br><-application/xml | | liste des pizzas (P2) | +| /pizza/{id} | GET | <-application/json<br><-application/xml | | une pizza (P2) ou 404 | +| /pizz/{id}/name| GET | <-text/plain | | le nom de le pizza ou 404 | +| /pizz/{id}/name| GET | <-text/plain | | la liste d'ingrédients ou 404 | +| /pizza | POST | <-/->application/json<br>->application/x-www-form-urlencoded | Pizza(P1) | Nouvelle pizza(P2)<br>409 si la pizza existe déjà (même nom) | +| /pizza/{id} | DELETE | | | | + + +Une pizza comporte uniquement une liste d'ingrédients, un identifiant et un nom. Sa +représentation JSON (P2) prendra donc la forme suivante : + + { + "[{"id": "f38806a8-7c85-49ef-980c-149dcd81d306", + "name": "Saumon"}], + "id": "f38806a8-7c85-49ef-980c-149dcd81d450", + "name": "Norvegienne" + } + +Lors de la création, l'identifiant n'est pas connu car il sera fourni +par le JavaBean qui représente un ingrédient. Aussi on aura une +représentation JSON (I1) qui comporte uniquement le nom et la liste des ingrédients : + + { + "[{"id": "f38806a8-7c85-49ef-980c-149dcd81d306", + "name": "Saumon"}], + "name": "Norveginne" + } diff --git a/Pizza.md~ b/Pizza.md~ new file mode 100644 index 0000000000000000000000000000000000000000..05f59608a0a42bfc9e4ddec3888d197f85d89a6c --- /dev/null +++ b/Pizza.md~ @@ -0,0 +1,29 @@ + | Réponse | +| :--------------| :---------- | :--------------------------------------------- | :-- | :---------------------------- | +| /pizza | GET | <-application/json<br><-application/xml | | liste des pizzas (P2) | +| /pizza/{id} | GET | <-application/json<br><-application/xml | | une pizza (P2) ou 404 | +| /pizz/{id}/name| GET | <-text/plain | | le nom de le pizza ou 404 | +| /pizz/{id}/name| GET | <-text/plain | | la liste d'ingrédients ou 404 | +| /pizza | POST | <-/->application/json<br>->application/x-www-form-urlencoded | Pizza(P1) | Nouvelle pizza(P2)<br>409 si la pizza existe déjà (même nom) | +| /pizza/{id} | DELETE | | | | + + +Une pizza comporte uniquement une liste d'ingrédients, un identifiant et un nom. Sa +représentation JSON (P2) prendra donc la forme suivante : + + { + "[{"id": "f38806a8-7c85-49ef-980c-149dcd81d306", + "name": "mozzarella"}], + "id": "f38806a8-7c85-49ef-980c-149dcd81d450", + "name": "Reine" + } + +Lors de la création, l'identifiant n'est pas connu car il sera fourni +par le JavaBean qui représente un ingrédient. Aussi on aura une +représentation JSON (I1) qui comporte uniquement le nom et la liste des ingrédients : + + { + "[{"id": "f38806a8-7c85-49ef-980c-149dcd81d306", + "name": "mozzarella"}], + "name": "Reine" + } diff --git a/bin/.gitignore b/bin/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..67516d3a4b87a2cc0ead755323100a2083eca900 --- /dev/null +++ b/bin/.gitignore @@ -0,0 +1,212 @@ + +# Created by https://www.gitignore.io/api/git,java,emacs,maven,java-web,visualstudiocode +# Edit at https://www.gitignore.io/?templates=git,java,emacs,maven,java-web,visualstudiocode + +### Emacs ### +# -*- mode: gitignore; -*- +*~ +\#*\# +/.emacs.desktop +/.emacs.desktop.lock +*.elc +auto-save-list +tramp +.\#* + +# Org-mode +.org-id-locations +*_archive + +# flymake-mode +*_flymake.* + +# eshell files +/eshell/history +/eshell/lastdir + +# elpa packages +/elpa/ + +# reftex files +*.rel + +# AUCTeX auto folder +/auto/ + +# cask packages +.cask/ +dist/ + +# Flycheck +flycheck_*.el + +# server auth directory +/server/ + +# projectiles files +.projectile + +# directory configuration +.dir-locals.el + +# network security +/network-security.data + + +### Git ### +# Created by git for backups. To disable backups in Git: +# $ git config --global mergetool.keepBackup false +*.orig + +# Created by git when using merge tools for conflicts +*.BACKUP.* +*.BASE.* +*.LOCAL.* +*.REMOTE.* +*_BACKUP_*.txt +*_BASE_*.txt +*_LOCAL_*.txt +*_REMOTE_*.txt + +### Java ### +# Compiled class file +*.class + +# Log file +*.log + +# BlueJ files +*.ctxt + +# Mobile Tools for Java (J2ME) +.mtj.tmp/ + +# Package Files # +*.jar +*.war +*.nar +*.ear +*.zip +*.tar.gz +*.rar + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* + +### Java-Web ### +## ignoring target file +target/ + +### Maven ### +pom.xml.tag +pom.xml.releaseBackup +pom.xml.versionsBackup +pom.xml.next +release.properties +dependency-reduced-pom.xml +buildNumber.properties +.mvn/timing.properties +.mvn/wrapper/maven-wrapper.jar +.flattened-pom.xml + +### VisualStudioCode ### +.vscode/ +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +.classpath + +### VisualStudioCode Patch ### +# Ignore all local history of files +.history + +# End of https://www.gitignore.io/api/git,java,emacs,maven,java-web,visualstudiocode + + +# Created by https://www.gitignore.io/api/eclipse,visualstudiocode +# Edit at https://www.gitignore.io/?templates=eclipse,visualstudiocode + +### Eclipse ### +.metadata +bin/ +tmp/ +*.tmp +*.bak +*.swp +*~.nib +local.properties +.settings/ +.loadpath +.recommenders + +# External tool builders +.externalToolBuilders/ + +# Locally stored "Eclipse launch configurations" +*.launch + +# PyDev specific (Python IDE for Eclipse) +*.pydevproject + +# CDT-specific (C/C++ Development Tooling) +.cproject + +# CDT- autotools +.autotools + +# Java annotation processor (APT) +.factorypath + +# PDT-specific (PHP Development Tools) +.buildpath + +# sbteclipse plugin +.target + +# Tern plugin +.tern-project + +# TeXlipse plugin +.texlipse + +# STS (Spring Tool Suite) +.springBeans + +# Code Recommenders +.recommenders/ + +# Annotation Processing +.apt_generated/ + +# Scala IDE specific (Scala & Java development for Eclipse) +.cache-main +.scala_dependencies +.worksheet + +### Eclipse Patch ### +# Eclipse Core +.project + +# JDT-specific (Eclipse Java Development Tools) +.classpath + +# Annotation Processing +.apt_generated + +.sts4-cache/ + +### VisualStudioCode ### +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json + +### VisualStudioCode Patch ### +# Ignore all local history of files +.history +.project +.settings +.classpath +# End of https://www.gitignore.io/api/eclipse,visualstudiocode diff --git a/bin/.project b/bin/.project new file mode 100644 index 0000000000000000000000000000000000000000..62cd99603bd1820b37594b90acea72ba65ffad22 --- /dev/null +++ b/bin/.project @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>m4102_tp3</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.m2e.core.maven2Builder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.jdt.core.javanature</nature> + <nature>org.eclipse.m2e.core.maven2Nature</nature> + </natures> +</projectDescription> diff --git a/bin/.settings/org.eclipse.core.resources.prefs b/bin/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000000000000000000000000000000000000..99f26c0203a7844de00dbfc56e6a35d8ed3c022c --- /dev/null +++ b/bin/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/<project>=UTF-8 diff --git a/bin/README.md b/bin/README.md new file mode 100644 index 0000000000000000000000000000000000000000..0c7fa501ed80ae20c710a2e5563f898563e0cd4e --- /dev/null +++ b/bin/README.md @@ -0,0 +1,984 @@ +# Projet REST avec Jersey + +## Récupération du projet initial +Pour récupérer le projet vous pouvez utiliser la commande `git clone +https://gitlab.univ-lille.fr/yvan.peter/m4102_tp3.git` + +L'arborescence ci-dessous vous montre le contenu du projet qui vous +servira de point de départ. Maven est configuré grâce au fichier +`pom.xml` qui permet entre autre de spécifier les dépendances du +projet. + +La classe `ApiV1` sera le point d'entrée de notre application REST qui +permet de configurer le chemin de l'URI (`@ApplicationPath`) ainsi que +les paquetages Java qui contiennent les ressources. + +~~~ +. +├── architecture.svg +├── pom.xml +├── README.md +└── src + ├── main + │ ├── java + │ │ └── fr + │ │ └── ulille + │ │ └── iut + │ │ └── pizzaland + │ │ ├── ApiV1.java + │ │ ├── BDDFactory.java + │ │ ├── beans + │ │ ├── dao + │ │ │ ├── UUIDArgumentFactory.java + │ │ │ └── UUIDArgument.java + │ │ ├── dto + │ │ │ └── IngredientDto.java + │ │ ├── Main.java + │ │ └── resources + │ │ ├── BDDClearRessource.java + │ │ └── IngredientResource.java + │ └── resources + │ ├── ingredients.json + │ └── logging.properties + └── test + ├── java + │ └── fr + │ └── ulille + │ └── iut + │ └── pizzaland + │ └── IngredientResourceTest.java + └── resources + └── logging.properties +~~~ + +## Développement d'une ressource *ingredients* + +### API et représentation des données + +Nous pouvons tout d'abord réfléchir à l'API REST que nous allons offrir pour la ressource *ingredients*. Celle-ci devrait répondre aux URI suivantes : + +| URI | Opération | MIME | Requête | Réponse | +| :----------------------- | :---------- | :--------------------------------------------- | :-- | :---------------------------------------------------- | +| /ingredients | GET | <-application/json<br><-application/xml | | liste des ingrédients (I2) | +| /ingredients/{id} | GET | <-application/json<br><-application/xml | | un ingrédient (I2) ou 404 | +| /ingredients/{id}/name | GET | <-text/plain | | le nom de l'ingrédient ou 404 | +| /ingredients | POST | <-/->application/json<br>->application/x-www-form-urlencoded | Ingrédient (I1) | Nouvel ingrédient (I2)<br>409 si l'ingrédient existe déjà (même nom) | +| /ingredients/{id} | DELETE | | | | + + +Un ingrédient comporte uniquement un identifiant et un nom. Sa +représentation JSON (I2) prendra donc la forme suivante : + + { + "id": "f38806a8-7c85-49ef-980c-149dcd81d306", + "name": "mozzarella" + } + +Lors de la création, l'identifiant n'est pas connu car il sera fourni +par le JavaBean qui représente un ingrédient. Aussi on aura une +représentation JSON (I1) qui comporte uniquement le nom : + + { "name": "mozzarella" } + +### Architecture logicielle de la solution + +La figure ci-dessous présente l'architecture globale qui devra être +mise en place pour notre développement : + + + +#### JavaBeans +JavaBean est un standard pour les objets Java permettant de les créer +et de les initialiser et de les manipuler facilement. Pour cela ces +objets doivent respecter un ensemble de conventions : + + - la classe est sérialisable + - elle fournit au moins un constructeur vide + - les attributs privés de la classe sont manipulables via des + méthodes publiques **get**_Attribut_ et **set**_Attribut_ + +Les DTO et la classe `Ingredient`décrits dans la suite sont des +JavaBeans. + +#### Data Transfer Object (DTO) +Les DTO correspondent à la représentation des données qui sera +transportée par HTTP. Ce sont des Javabeans qui possèdent les même +propriétés que la représentation (avec les getter/setter +correspondants). + +Jersey utilisera les *setter* pour initialiser l'objet à partir +de la représentation JSON ou XML et les *getter* pour créer la +représentation correspondante. + +#### Data Access Object (DAO) +Le DAO permet de faire le lien entre la représentation objet et le +contenu de la base de données. + +Nous utiliserons la [librairie JDBI](http://jdbi.org/) qui permet +d'associer une interface à des requêtes SQL. +La classe `BDDFactory` qui vous est fournie permet un accès facilité +aux fonctionnalités de JDBI. + +#### La représentation des données manipulées par la ressource +La classe `Ingredient` est un JavaBean qui représente ce qu'est un +ingrédient. Elle porte des méthodes pour passer de cette +représentation aux DTO. + +Cela permet de découpler l'implémentation de la ressource qui traite +les requêtes HTTP et la donnée manipulée. + +Cette classe pourrait +porter des comportements liés à cette donnée (par ex. calcul de TVA). + +## Mise en œuvre + +### Une première implémentation : récupérer les ingrédients existants +Nous allons réaliser un développement dirigé par les tests. Dans un +premier temps, nous allons commencer par un test qui récupère une +liste d'ingrédients vide qui sera matérialisée par un tableau JSON +vide `[]`. + +Le code suivant qui se trouve dans la classe `IngredientResourceTest` +montre la mise en place de l'environnement (`configure()`) et l'amorce +d'un premier test. + +~~~java +public class IngredientResourceTest extends JerseyTest { + + @Override + protected Application configure() { + return new ApiV1(); + } + + @Test + public void testGetEmptyList() { + Response response = target("/ingredients").request().get(); + + // Vérification de la valeur de retour (200) + assertEquals(Response.Status.OK.getStatusCode(), response.getStatus()); + + // Vérification de la valeur retournée (liste vide) + List<IngredientDto> ingredients; + ingredients = response.readEntity(new GenericType<List<IngredientDto>>(){}); + + assertEquals(0, ingredients.size()); + } +~~~ + +En héritant de JerseyTest, votre classe de test se comporte comme un +[`Client` +JAX-RS](https://docs.oracle.com/javaee/7/api/jakarta/ws/rs/client/Client.html). La +méthode `target()` notamment permet de préparer une requête sur une +URI particulière. + + +Vous pouvez compiler votre code ainsi que les tests au moyen +des commandes `mvn compile` et `mvn test-compile`. La compilation du +code et des tests se fera automatiquement si nécessaire quand vous +faites un `mvn test`. + +Pour pouvoir compiler ce premier test, il faut au minimum fournir le +DTO `IngredientDto`. +Pour commencer, on se contentera de l'implémentation minimale +suivante : + +~~~java +package fr.ulille.iut.pizzaland.dto; + + public class IngredientDto { + + public IngredientDto() { + } +} +~~~ + +Pour réussir, ce premier test, nous allons mettre en place la +ressource `IngredientResource`. + +Une première implémentation de la ressource pourra avoir la forme +suivante : + +~~~java +@Path("/ingredients") +public class IngredientResource { + + @Context + public UriInfo uriInfo; + + public IngredientResource() { + } + + @GET + public List<IngredientDto> getAll() { + + return new ArrayList<IngredientDto>(); + } +} +~~~ + +Avec cette première implémentation, on va pouvoir tester notre +ressource : + +~~~ +$ mvn test + +Results : + +Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 +~~~ + +### Récupérer un ingrédient existant +Nous allons continuer en ajoutant la possibilité de récupérer un +ingrédient particulier à partir de son identifiant. +Pour cela voici un premier test qui permettra de vérifier cela : + +~~~java +import fr.ulille.iut.pizzaland.beans.Ingredient; + + @Test + public void testGetExistingIngredient() { + + Ingredient ingredient = new Ingredient(); + ingredient.setName("Chorizo"); + + Response response = target("/ingredients").path(ingredient.getId().toString()).request(MediaType.APPLICATION_JSON).get(); + + assertEquals(Response.Status.OK.getStatusCode(), response.getStatus()); + + Ingredient result = Ingredient.fromDto(response.readEntity(IngredientDto.class)); + assertEquals(ingredient, result); + } + } +~~~ + +Vous pourrez vérifier que le test échoue au moyen de la commande `mvn test` + +Afin de réussir ce test, nous devons compléter la classe IngredientDto +avec les getter/setter correspondant aux propriétés de l'object JSON. + +~~~java +public class IngredientDto { + private UUID id; + private String name; + + public IngredientDto() { + } + + public void setId(UUID id) { + this.id = id; + } + + public UUID getId() { + return id; + } + + public void setName(String name) { + this.name = name; + } + + public String getName() { + return name; + } +~~~ + +Du côté de la ressource, on peut fournir une première implémentation : + +~~~java +import jakarta.ws.rs.PathParam; +import fr.ulille.iut.pizzaland.beans.Ingredient; + + @GET + @Path("{id}") + public IngredientDto getOneIngredient(@PathParam("id") UUID id) { + Ingredient ingredient = new Ingredient(); + ingredient.setId(id); // juste pour avoir le même id pour le test + ingredient.setName("Chorizo"); + + return Ingredient.toDto(ingredient); + } +~~~ + +Pour cette méthode, nous avons introduit la classe `Ingredient`. Ce +JavaBean représente un ingrédient manipulé par la ressource. +Voici une implémentation pour cette classe : + +~~~java +package fr.ulille.iut.pizzaland.beans; + +import java.util.UUID; + +import fr.ulille.iut.pizzaland.dto.IngredientDto; + +public class Ingredient { + private UUID id = UUID.randomUUID(); + private String name; + + public Ingredient() { + } + + public Ingredient(String name) { + this.name = name; + } + + public Ingredient(UUID id, String name) { + this.id = id; + this.name = name; + } + + public void setId(UUID id) { + this.id = id; + } + + public UUID getId() { + return id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public static IngredientDto toDto(Ingredient i) { + IngredientDto dto = new IngredientDto(); + dto.setId(i.getId()); + dto.setName(i.getName()); + + return dto; + } + + public static Ingredient fromDto(IngredientDto dto) { + Ingredient ingredient = new Ingredient(); + ingredient.setId(dto.getId()); + ingredient.setName(dto.getName()); + + return ingredient; + } + + @Override + public String toString() { + return "Ingredient [id=" + id + ", name=" + name + "]"; + } +} +~~~ + +Les méthodes `toDto()` et `fromDto()` permettrons de faire la conversion entre le Bean `Ingredient` et le DTO qui représente ce qui sera transféré dans la requête/réponse HTTP. + +Pour les différents beans que nous allons écrire générez également les méthodes `hashCode()` et `equals()` et `toString()`. + +Le test devrait maintenant réussir : + +~~~ +$ mvn test +~~~ + +## Introduction de la persistence +Pour aller plus loin et mettre en place la création des ingrédients il +va falloir introduire la persistence. Pour cela, nous allons utiliser +la librairie JDBI qui permet d'associer un modèle objet aux tables de +base de données. + +Pour cela nous allons devoir implémenter le DAO (Data Access Object) `IngredientDao` : + +~~~java +package fr.ulille.iut.pizzaland.dao; + +import java.util.List; +import java.util.UUID; + +import org.jdbi.v3.sqlobject.config.RegisterBeanMapper; +import org.jdbi.v3.sqlobject.customizer.Bind; +import org.jdbi.v3.sqlobject.customizer.BindBean; +import org.jdbi.v3.sqlobject.statement.SqlQuery; +import org.jdbi.v3.sqlobject.statement.SqlUpdate; + +import fr.ulille.iut.pizzaland.beans.Ingredient; + +public interface IngredientDao { + + @SqlUpdate("CREATE TABLE IF NOT EXISTS ingredients (id VARCHAR(128) PRIMARY KEY, name VARCHAR UNIQUE NOT NULL)") + void createTable(); + + @SqlUpdate("DROP TABLE IF EXISTS ingredients") + void dropTable(); + + @SqlUpdate("INSERT INTO ingredients (id, name) VALUES (:id, :name)") + void insert(@BindBean Ingredient ingredient); + + @SqlUpdate("DELETE FROM ingredients WHERE id = :id") + void remove(@Bind("id") UUID id); + + @SqlQuery("SELECT * FROM ingredients WHERE name = :name") + @RegisterBeanMapper(Ingredient.class) + Ingredient findByName(@Bind("name") String name); + + @SqlQuery("SELECT * FROM ingredients") + @RegisterBeanMapper(Ingredient.class) + List<Ingredient> getAll(); + + @SqlQuery("SELECT * FROM ingredients WHERE id = :id") + @RegisterBeanMapper(Ingredient.class) + Ingredient findById(@Bind("id") UUID id); +} +~~~ + +JDBI fonctionne par annotations : + - Les annotations `sqlUpdate` et `SqlQuery` correspondent à des + requêtes SQL en modification ou non. + - `@RegisterBeanMapper` permet d'associer une classe à un résultat + (les champs de la table sont associés aux propriétés du bean). + - `@Bind` permet d'associer un paramètre de méthode à un paramètre nommé dans la requête SQL. + +Reprenons maintenant le code déjà écrit pour aller chercher les +ingrédients dans une base de données (nous utiliserons `Sqlite`). + +### Les tests avec la base de données +Nous allons utiliser le DAO pour insérer des données dans la table +afin de réaliser nos tests. Nous utiliserons une base de données de +tests qui est définie via la classe `BDDFactory`. + +Dans la classe `IngredientResourceTest`Les méthodes `setEnvUp` et `tearEnvDown` permettent de créer et +détruire la base de données entre chaque test. + +~~~java +import fr.ulille.iut.pizzaland.dao.IngredientDao; + +public class IngredientResourceTest extends JerseyTest { + private IngredientDao dao; + + @Override + protected Application configure() { + BDDFactory.setJdbiForTests(); + + return new ApiV1(); + } + + @Before + public void setEnvUp() { + dao = BDDFactory.buildDao(IngredientDao.class); + dao.createTable(); + } + + @After + public void tearEnvDown() throws Exception { + dao.dropTable(); + } + + @Test + public void testGetExistingIngredient() { + Ingredient ingredient = new Ingredient(); + ingredient.setName("Chorizo"); + dao.insert(ingredient); + + Response response = target("/ingredients").path(ingredient.getId().toString()).request(MediaType.APPLICATION_JSON).get(); + + assertEquals(Response.Status.OK.getStatusCode(), response.getStatus()); + + Ingredient result = Ingredient.fromDto(response.readEntity(IngredientDto.class)); + assertEquals(ingredient, result); +} +~~~ + +### La ressource avec la base de données + +~~~java +@Produces("application/json") +@Path("/ingredients") +public class IngredientResource { + private static final Logger LOGGER = Logger.getLogger(IngredientResource.class.getName()); + + private IngredientDao ingredients; + + @Context + public UriInfo uriInfo; + + public IngredientResource() { + ingredients = BDDFactory.buildDao(IngredientDao.class); + ingredients.createTable(); + } + + @GET + public List<IngredientDto> getAll() { + LOGGER.info("IngredientResource:getAll"); + + List<IngredientDto> l = ingredients.getAll().stream().map(Ingredient::toDto).collect(Collectors.toList()); + LOGGER.info(l.toString()); + return l; + } + + @GET + @Path("{id}") + @Produces({ "application/json", "application/xml" }) + public IngredientDto getOneIngredient(@PathParam("id") UUID id) { + LOGGER.info("getOneIngredient(" + id + ")"); + try { + Ingredient ingredient = ingredients.findById(id); + LOGGER.info(ingredient.toString()); + return Ingredient.toDto(ingredient); + } catch (Exception e) { + throw new WebApplicationException(Response.Status.NOT_FOUND); + } + } +} +~~~ + +### Les tests fonctionnent avec la base de données +Nous pouvons maintenant vérifier que la base fonctionne avec la base +de données : + +~~~ +$ mvn test + +Results : + +Tests run: 2, Failures: 0, Errors: 0, Skipped: 0 +~~~ + +## Complétons maintenant les différents tests +L'implémentation de la classe devrait fonctionner avec le test suivant +: + +~~~java + @Test + public void testGetNotExistingIngredient() { + Response response = target("/ingredients").path(UUID.randomUUID().toString()).request().get(); + assertEquals(Response.Status.NOT_FOUND.getStatusCode(),response.getStatus()); + } + +~~~ + +~~~ +$ mvn test + +Results : + +Tests run: 3, Failures: 0, Errors: 0, Skipped: 0 +~~~ + +### Implementation de la méthode POST +Il va falloir implémenter la méthode POST pour la création des +ingrédients. Commençons par les différents tests : création, création +de deux ingrédients identiques et création d'ingrédient sans nom. + +~~~java +import fr.ulille.iut.pizzaland.dto.IngredientCreateDto; + + @Test + public void testCreateIngredient() { + IngredientCreateDto ingredientCreateDto = new IngredientCreateDto(); + ingredientCreateDto.setName("Chorizo"); + + Response response = target("/ingredients").request().post(Entity.json(ingredientCreateDto)); + + assertEquals(Response.Status.CREATED.getStatusCode(), response.getStatus()); + + IngredientDto returnedEntity = response.readEntity(IngredientDto.class); + + assertEquals(target("/ingredients/" + returnedEntity.getId()).getUri(), response.getLocation()); + assertEquals(returnedEntity.getName(), ingredientCreateDto.getName()); + } + + @Test + public void testCreateSameIngredient() { + Ingredient ingredient = new Ingredient(); + ingredient.setName("Chorizo"); + dao.insert(ingredient); + + IngredientCreateDto ingredientCreateDto = Ingredient.toCreateDto(ingredient); + Response response = target("/ingredients").request().post(Entity.json(ingredientCreateDto)); + + assertEquals(Response.Status.CONFLICT.getStatusCode(), response.getStatus()); + } + + @Test + public void testCreateIngredientWithoutName() { + IngredientCreateDto ingredientCreateDto = new IngredientCreateDto(); + + Response response = target("/ingredients").request().post(Entity.json(ingredientCreateDto)); + + assertEquals(Response.Status.NOT_ACCEPTABLE.getStatusCode(), response.getStatus()); + } + +~~~ + +Nous utiliserons un DTO spécifique `IngredientCreateDto` dans la +mesure où nous n'aurons que le nom de l'ingrédient pour la création. + +La classe [`jakarta.ws.rs.client.Entity<T>`](https://docs.oracle.com/javaee/7/api/jakarta/ws/rs/client/Entity.html) permet de définir le corps de +la requête POST et le type de données associée (ici `application/json`). + +Nous devons également fournir une implémentation de +`IngredientCreateDto` pour pouvoir compiler notre code : + +~~~java +package fr.ulille.iut.pizzaland.dto; + +public class IngredientCreateDto { + private String name; + + public IngredientCreateDto() {} + + public void setName(String name) { + this.name = name; + } + + public String getName() { + return name; + } +} +~~~ + +Nous pouvons maintenant compiler notre code de test et constater que +ceux-ci échouent. + +~~~ +$ mvn test + +Results : + +Failed tests: testCreateSameIngredient(fr.ulille.iut.pizzaland.IngredientResourceTest): expected:<409> but was:<405> + testCreateIngredientWithoutName(fr.ulille.iut.pizzaland.IngredientResourceTest): expected:<406> but was:<405> + testCreateIngredient(fr.ulille.iut.pizzaland.IngredientResourceTest): expected:<201> but was:<405> + +Tests run: 6, Failures: 3, Errors: 0, Skipped: 0 +~~~ + +Nous pouvons maintenant implémenter notre méthode POST dans la + ressource : + +~~~java +import jakarta.ws.rs.POST; +import fr.ulille.iut.pizzaland.dto.IngredientCreateDto; + + @POST + public Response createIngredient(IngredientCreateDto ingredientCreateDto) { + Ingredient existing = ingredients.findByName(ingredientCreateDto.getName()); + if (existing != null) { + throw new WebApplicationException(Response.Status.CONFLICT); + } + + try { + Ingredient ingredient = Ingredient.fromIngredientCreateDto(ingredientCreateDto); + ingredients.insert(ingredient); + IngredientDto ingredientDto = Ingredient.toDto(ingredient); + + URI uri = uriInfo.getAbsolutePathBuilder().path(ingredient.getId().toString()).build(); + + return Response.created(uri).entity(ingredientDto).build(); + } catch (Exception e) { + e.printStackTrace(); + throw new WebApplicationException(Response.Status.NOT_ACCEPTABLE); + } + + } +~~~ + +Comme nous vérifions qu'il n'y a pas déjà un ingrédient avec le nom +fourni, nous devont ajouter une méthode `findbyName` à notre DAO + +~~~java + @SqlQuery("SELECT * FROM ingredients WHERE name = :name") + @RegisterBeanMapper(Ingredient.class) + Ingredient findByName(@Bind("name") String name); +~~~ + +Nous avons également besoin de rajouter les méthodes de conversion + pour ce DTO à notre bean `Ingredient` : + +~~~java +import fr.ulille.iut.pizzaland.dto.IngredientCreateDto; + + public static IngredientCreateDto toCreateDto(Ingredient ingredient) { + IngredientCreateDto dto = new IngredientCreateDto(); + dto.setName(ingredient.getName()); + + return dto; + } + + public static Ingredient fromIngredientCreateDto(IngredientCreateDto dto) { + Ingredient ingredient = new Ingredient(); + ingredient.setName(dto.getName()); + + return ingredient; + } +~~~ + +Nous pouvons maintenant vérifier nos tests : + +~~~ +$ mvn test + +Results : + +Tests run: 6, Failures: 0, Errors: 0, Skipped: 0 +~~~ + +Vous aurez peut-être un affichage d'exception liée au test de création +de doublon, toutefois le test est réussi puisqu'il a levé une +exception qui a été traduite par un code d'erreur HTTP 406. + +### Implémentation de la méthode DELETE +Les tests liés à la méthode DELETE sont les suivants : + +~~~java + @Test + public void testDeleteExistingIngredient() { + Ingredient ingredient = new Ingredient(); + ingredient.setName("Chorizo"); + dao.insert(ingredient); + + Response response = target("/ingredients/").path(ingredient.getId().toString()).request().delete(); + + assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatus()); + + Ingredient result = dao.findById(ingredient.getId()); + assertEquals(result, null); + } + + @Test + public void testDeleteNotExistingIngredient() { + Response response = target("/ingredients").path(UUID.randomUUID().toString()).request().delete(); + assertEquals(Response.Status.NOT_FOUND.getStatusCode(), response.getStatus()); + } +~~~ + +Après avoir constaté que ces tests échouent, nous pouvons fournir une +implémentation pour la méthode DELETE : + +~~~java +import jakarta.ws.rs.DELETE; + + @DELETE + @Path("{id}") + public Response deleteIngredient(@PathParam("id") UUID id) { + if ( ingredients.findById(id) == null ) { + throw new WebApplicationException(Response.Status.NOT_FOUND); + } + + ingredients.remove(id); + + return Response.status(Response.Status.ACCEPTED).build(); + } +~~~ + +Nous devons également implémenter la méthode remove dans +`IngredientDao` : + +~~~java + @SqlUpdate("DELETE FROM ingredients WHERE id = :id") + void remove(@Bind("id") UUID id); +~~~ + +Avec cette implémentation, nos tests réussissent. + +### Implémentation de la méthode GET pour récupérer le nom de l'ingrédient +Commençons par les tests correspondant à cette URI (GET +/ingredients/{id}/name) + +~~~java + @Test + public void testGetIngredientName() { + Ingredient ingredient = new Ingredient(); + ingredient.setName("Chorizo"); + dao.insert(ingredient); + + Response response = target("ingredients").path(ingredient.getId().toString()).path("name").request().get(); + + assertEquals(Response.Status.OK.getStatusCode(), response.getStatus()); + + assertEquals("Chorizo", response.readEntity(String.class)); + } + + @Test + public void testGetNotExistingIngredientName() { + Response response = target("ingredients").path(UUID.randomUUID().toString()).path("name").request().get(); + + assertEquals(Response.Status.NOT_FOUND.getStatusCode(), response.getStatus()); + } +~~~ + +L'implémentation correspondant à ce test est simple : + +~~~java + @GET + @Path("{id}/name") + public String getIngredientName(@PathParam("id") UUID id) { + Ingredient ingredient = ingredients.findById(id); + + if (ingredient == null) { + throw new WebApplicationException(Response.Status.NOT_FOUND); + } + + return ingredient.getName(); + } +~~~ + +### Implémentation d'une méthode de création avec des données de formulaire +La création d'un ingrédient pourrait également se faire via un +formulaire Web. Dans ce cas, le type de représentation sera +`application/x-www-form-urlencoded`. + +On peut déjà préparer un test pour cette méthode de création : + +~~~java + @Test + public void testCreateWithForm() { + Form form = new Form(); + form.param("name", "chorizo"); + + Entity<Form> formEntity = Entity.entity(form, MediaType.APPLICATION_FORM_URLENCODED_TYPE); + Response response = target("ingredients").request().post(formEntity); + + assertEquals(Response.Status.CREATED.getStatusCode(), response.getStatus()); + String location = response.getHeaderString("Location"); + String id = location.substring(location.lastIndexOf('/') + 1); + Ingredient result = dao.findById(UUID.fromString(id)); + + assertNotNull(result); + } +~~~ + +On peut maintenant fournir une implémentation pour cette méthode : + +~~~java + @POST + @Consumes("application/x-www-form-urlencoded") + public Response createIngredient(@FormParam("name") String name) { + Ingredient existing = ingredients.findByName(name); + if (existing != null) { + throw new WebApplicationException(Response.Status.CONFLICT); + } + + try { + Ingredient ingredient = new Ingredient(); + ingredient.setName(name); + + ingredients.insert(ingredient); + + IngredientDto ingredientDto = Ingredient.toDto(ingredient); + + URI uri = uriInfo.getAbsolutePathBuilder().path("" + ingredient.getId()).build(); + + return Response.created(uri).entity(ingredientDto).build(); + } catch (Exception e) { + e.printStackTrace(); + throw new WebApplicationException(Response.Status.NOT_ACCEPTABLE); + } + } +~~~ + +# Créer une base de données de test +Nous avons maintenant implémenté et testé toutes les méthodes prévues +par notre API. Si nous voulons tester avec des clients, il serait bien +d'avoir quelques ingrédients dans la base de données. Pour cela, nous +allons donner la possibilité de créer des ingrédients au démarrage sur la base +d'une variable d'environnement : `PIZZAENV`. + +Quand cette variable aura la valeur `withdb`, nous allons remplir la +base au démarrage avec le code suivant : + +~~~java +package fr.ulille.iut.pizzaland; + +import org.glassfish.jersey.server.ResourceConfig; + +import fr.ulille.iut.pizzaland.beans.Ingredient; +import fr.ulille.iut.pizzaland.beans.Pizza; +import fr.ulille.iut.pizzaland.dao.IngredientDao; +import fr.ulille.iut.pizzaland.dao.PizzaDao; +import fr.ulille.iut.pizzaland.dto.PizzaCreateDto; + +import java.io.FileReader; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; +import java.util.logging.Logger; + +import jakarta.json.bind.JsonbBuilder; +import jakarta.ws.rs.ApplicationPath; + +@ApplicationPath("api/v1/") +public class ApiV1 extends ResourceConfig { + private static final Logger LOGGER = Logger.getLogger(ApiV1.class.getName()); + + public ApiV1() { + packages("fr.ulille.iut.pizzaland"); + String environment = System.getenv("PIZZAENV"); + + if ( environment != null && environment.equals("withdb") ) { + LOGGER.info("Loading with database"); + try { + FileReader reader = new FileReader( getClass().getClassLoader().getResource("ingredients.json").getFile() ); + List<Ingredient> ingredients = JsonbBuilder.create().fromJson(reader, new ArrayList<Ingredient>(){}.getClass().getGenericSuperclass()); + + IngredientDao ingredientDao = BDDFactory.buildDao(IngredientDao.class); + ingredientDao.dropTable(); + ingredientDao.createTable(); + for ( Ingredient ingredient: ingredients) { + ingredientDao.insert(ingredient); + } + } catch ( Exception ex ) { + throw new IllegalStateException(ex); + } + } + } +} +~~~ + +Dans un terminal, nous pouvons maintenant fixer la variable +d'environnemnet et démarrer notre serveur REST au moyen de la +commande `mvn exec:java` : + +~~~ +$ export PIZZAENV=withdb +$ mvn exec:java +~~~ +Dans un autre terminal, nous pouvons utiliser `curl` pour tester nos +différentes méthodes : + +~~~ +$ curl -i localhost:8080/api/v1/ingredients + +HTTP/1.1 200 OK +Content-Type: application/json +Content-Length: 760 + +[{"id":"f38806a8-7c85-49ef-980c-149dcd81d306","name":"mozzarella"},{"id":"d36903e1-0cc0-4bd6-a0ed-e0e9bf7b4037","name":"jambon"},{"id":"bc5b315f-442f-4ee4-96de-486d48f20c2f","name":"champignons"},{"id":"6a04320c-3a4f-4570-96d3-61faf3f898b0","name":"olives"},{"id":"c77deeee-d50d-49d5-9695-c98ec811f762","name":"tomate"},{"id":"c9375542-8142-43f6-b54d-0d63597cf614","name":"merguez"},{"id":"dee27dd6-f9b6-4d03-ac4b-216b5c9c8bd7","name":"lardons"},{"id":"657f8dd4-6bc1-4622-9af7-37d248846a23","name":"fromage"},{"id":"070d8077-a713-49a0-af37-3936b63d5ff2","name":"oeuf"},{"id":"5d9ca5c4-517f-40fd-aac3-5a823d680c1d","name":"poivrons"},{"id":"52f68024-24ec-46c0-8e77-c499dba1e27e","name":"ananas"},{"id":"dfdf6fae-f1b2-45fa-8c39-54e522c1933f","name":"reblochon"}] +~~~ + +# Implémentation de la ressource Pizza +Maintenant que vous avez une ressource `ingrédients` fonctionnelle, vous pouvez passer à l'implémentation de la ressource `Pizzas`. Pour cette ressource, vous devrez d'abord définir l'API dans le fichier `pizzas.md` (URI, méthodes, représentations). Ensuite, vous pourrez développer la ressource avec les tests associés. + +Il est fortement recommandé d'adopter la même approche que pour `Ingredient` en développement progressivement les tests puis les fonctionnalitées associées. + +## Note sur la base de données +Une pizza comprend des ingrédients. Pour développer cette ressource, +vous aurez donc besoin d'un table d'association au niveau de la base +de données. Cela pourra être géré au niveau du DAO grâce à +[JDBI](https://jdbi.org/#_default_methods). Cet extrait de code montre +comment faire : + +~~~java +import org.jdbi.v3.sqlobject.transaction.Transaction; + + public interface PizzaDao { + + @SqlUpdate("CREATE TABLE IF NOT EXISTS Pizzas ....") + void createPizzaTable(); + + @SqlUpdate("CREATE TABLE IF NOT EXISTS PizzaIngredientsAssociation .....") + void createAssociationTable(); + + @Transaction + default void createTableAndIngredientAssociation() { + createAssociationTable(); + createPizzaTable(); + } +~~~ + +Vous écrivez les différentes méthodes annotées avec `@SqlUpdate` ou +`@SqlQuery`. Vous utilisez ensuite ces méthodes au sein d'une méthode +ayant le mot clé `default`. C'est cette méthode que vous utiliserez +dans votre ressource. diff --git a/bin/architecture.svg b/bin/architecture.svg new file mode 100644 index 0000000000000000000000000000000000000000..61b135b809a73a335a284b999dc22e76f567057c --- /dev/null +++ b/bin/architecture.svg @@ -0,0 +1,409 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> + +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + width="297mm" + height="210mm" + viewBox="0 0 297 210" + version="1.1" + id="svg8" + inkscape:version="0.92.4 (5da689c313, 2019-01-14)" + sodipodi:docname="architecture.svg"> + <defs + id="defs2"> + <marker + inkscape:stockid="Arrow2Mstart" + orient="auto" + refY="0.0" + refX="0.0" + id="Arrow2Mstart" + style="overflow:visible" + inkscape:isstock="true"> + <path + id="path877" + style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round;stroke:#000000;stroke-opacity:1;fill:#000000;fill-opacity:1" + d="M 8.7185878,4.0337352 L -2.2072895,0.016013256 L 8.7185884,-4.0017078 C 6.9730900,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z " + transform="scale(0.6) translate(0,0)" /> + </marker> + <marker + inkscape:isstock="true" + style="overflow:visible;" + id="marker1309" + refX="0.0" + refY="0.0" + orient="auto" + inkscape:stockid="Arrow1Mend"> + <path + transform="scale(0.4) rotate(180) translate(10,0)" + style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1;fill:#000000;fill-opacity:1" + d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z " + id="path1307" /> + </marker> + <marker + inkscape:stockid="Arrow1Mend" + orient="auto" + refY="0.0" + refX="0.0" + id="marker1133" + style="overflow:visible;" + inkscape:isstock="true"> + <path + id="path1131" + d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z " + style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1;fill:#000000;fill-opacity:1" + transform="scale(0.4) rotate(180) translate(10,0)" /> + </marker> + <marker + inkscape:isstock="true" + style="overflow:visible" + id="marker1309-9" + refX="0" + refY="0" + orient="auto" + inkscape:stockid="Arrow1Mend"> + <path + inkscape:connector-curvature="0" + transform="matrix(-0.4,0,0,-0.4,-4,0)" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;stroke-opacity:1" + d="M 0,0 5,-5 -12.5,0 5,5 Z" + id="path1307-2" /> + </marker> + </defs> + <sodipodi:namedview + id="base" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + inkscape:pageopacity="0.0" + inkscape:pageshadow="2" + inkscape:zoom="1.0180159" + inkscape:cx="482.67561" + inkscape:cy="436.14251" + inkscape:document-units="mm" + inkscape:current-layer="layer1" + showgrid="false" + inkscape:window-width="1920" + inkscape:window-height="1015" + inkscape:window-x="0" + inkscape:window-y="0" + inkscape:window-maximized="1" /> + <metadata + id="metadata5"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + <dc:title /> + </cc:Work> + </rdf:RDF> + </metadata> + <g + inkscape:label="Calque 1" + inkscape:groupmode="layer" + id="layer1" + transform="translate(0,-87)"> + <rect + style="opacity:1;fill:none;fill-opacity:0.92941176;stroke:#1a1a1a;stroke-width:0.46499997;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="rect815" + width="166.28093" + height="115.33292" + x="74.191422" + y="125.01431" + ry="9.5569305" /> + <text + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.93888855px;line-height:1.25;font-family:Courier;-inkscape-font-specification:Courier;text-align:start;letter-spacing:0px;word-spacing:0px;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332" + x="0.68180948" + y="205.90202" + id="text819"><tspan + sodipodi:role="line" + id="tspan817" + x="0.68180948" + y="205.90202" + style="stroke-width:0.26458332">{ "name": "mozzarella" }</tspan></text> + <text + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.93888855px;line-height:1.25;font-family:Courier;-inkscape-font-specification:Courier;text-align:start;letter-spacing:0px;word-spacing:0px;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332" + x="1.9142494" + y="145.94934" + id="text819-3"><tspan + sodipodi:role="line" + id="tspan817-6" + x="1.9142494" + y="145.94934" + style="stroke-width:0.26458332">{</tspan><tspan + sodipodi:role="line" + x="1.9142494" + y="152.12296" + style="stroke-width:0.26458332" + id="tspan843"> "id": 1,</tspan><tspan + sodipodi:role="line" + x="1.9142494" + y="158.29657" + style="stroke-width:0.26458332" + id="tspan839"> "name": "mozzarella"</tspan><tspan + sodipodi:role="line" + x="1.9142494" + y="164.47017" + style="stroke-width:0.26458332" + id="tspan841">}</tspan></text> + <g + id="g912" + transform="translate(-137.34242,94.920052)"> + <ellipse + ry="7.6670794" + rx="28.84901" + cy="127.93441" + cx="244.04703" + id="path845" + style="opacity:1;fill:none;fill-opacity:0.92941176;stroke:#1a1a1a;stroke-width:0.46499997;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" /> + <text + id="text853" + y="129.16666" + x="215.79419" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.93888855px;line-height:1.25;font-family:Courier;-inkscape-font-specification:Courier;text-align:start;letter-spacing:0px;word-spacing:0px;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332" + xml:space="preserve"><tspan + style="stroke-width:0.26458332" + y="129.16666" + x="215.79419" + id="tspan851" + sodipodi:role="line">IngredientCreateDto</tspan></text> + </g> + <g + id="g917" + transform="translate(-106.72563,21.571782)"> + <g + id="g13293" + transform="translate(0,1.596614)"> + <text + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.93888855px;line-height:1.25;font-family:Courier;-inkscape-font-specification:Courier;text-align:start;letter-spacing:0px;word-spacing:0px;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332" + x="220.45509" + y="160.74463" + id="text857"><tspan + sodipodi:role="line" + id="tspan855" + x="220.45509" + y="160.74463" + style="stroke-width:0.26458332">IngredientResource</tspan></text> + <ellipse + cx="247.25438" + cy="159.51237" + rx="28.84901" + ry="30.538366" + style="opacity:1;fill:none;fill-opacity:0.92941176;stroke:#1a1a1a;stroke-width:0.46499997;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="path845-7" /> + </g> + </g> + <g + id="g922" + transform="translate(-23.037538,0.55700684)"> + <text + id="text861" + y="183.35602" + x="220.51999" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.93888855px;line-height:1.25;font-family:Courier;-inkscape-font-specification:Courier;text-align:start;letter-spacing:0px;word-spacing:0px;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332" + xml:space="preserve"><tspan + id="tspan863" + style="stroke-width:0.26458332" + y="183.35602" + x="220.51999" + sodipodi:role="line">IngredientDao</tspan></text> + <ellipse + cx="239.88861" + cy="182.12376" + rx="22.611387" + ry="7.6670794" + id="path845-5" + style="opacity:1;fill:none;fill-opacity:0.92941176;stroke:#1a1a1a;stroke-width:0.46499997;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" /> + </g> + <g + id="g927" + transform="translate(-43.829617,-56.398515)"> + <text + id="text869" + y="206.7471" + x="217.68291" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.93888855px;line-height:1.25;font-family:Courier;-inkscape-font-specification:Courier;text-align:start;letter-spacing:0px;word-spacing:0px;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332" + xml:space="preserve"><tspan + style="stroke-width:0.26458332" + y="206.7471" + x="217.68291" + id="tspan867" + sodipodi:role="line">Ingredient</tspan></text> + <ellipse + ry="7.6670794" + rx="16.373762" + cy="205.51485" + cx="232.58473" + id="path845-3" + style="opacity:1;fill:none;fill-opacity:0.92941176;stroke:#1a1a1a;stroke-width:0.46499997;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" /> + </g> + <g + id="g907" + transform="translate(-106.44231,37.666913)"> + <text + id="text849" + y="109.80403" + x="192.19078" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.93888855px;line-height:1.25;font-family:Courier;-inkscape-font-specification:Courier;text-align:start;letter-spacing:0px;word-spacing:0px;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332" + xml:space="preserve"><tspan + style="stroke-width:0.26458332" + y="109.80403" + x="192.19078" + id="tspan847" + sodipodi:role="line">IngredientDto</tspan></text> + <ellipse + ry="7.6670794" + rx="22.871288" + cy="108.57178" + cx="211.5594" + id="path845-56" + style="opacity:1;fill:none;fill-opacity:0.92941176;stroke:#1a1a1a;stroke-width:0.46499997;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" /> + </g> + <g + transform="matrix(0.26458333,0,0,0.26458333,231.86606,-9.438136)" + inkscape:label="Calque 1" + id="layer1-9"> + <path + d="m 174.72,639.58 c -29.2,0 -52.91,13.35 -52.91,29.79 v 119.12 c 0,16.44 23.71,29.78 52.91,29.78 29.2,0 52.91,-13.34 52.91,-29.78 V 669.37 h -0.04 c 0,-16.44 -23.67,-29.79 -52.87,-29.79 z" + style="fill:#ffffff;stroke:#000000;stroke-width:10;stroke-linecap:round;stroke-linejoin:round" + id="rect3196" + inkscape:connector-curvature="0" /> + <ellipse + transform="matrix(1.6639,0,0,1.6225,-131.61,-463.2)" + style="fill:#ffffff;stroke:#000000;stroke-width:2.9375;stroke-linecap:round;stroke-linejoin:round" + id="path2527" + cx="184.11563" + cy="698.03149" + rx="30.68594" + ry="17.716536" /> + </g> + <path + style="fill:none;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#marker1309)" + d="M 2.339109,199.8064 117.47524,199.2866" + id="path1129" + inkscape:connector-curvature="0" + sodipodi:nodetypes="cc" /> + <path + style="fill:none;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#marker1309-9)" + d="M 2.0517682,166.28965 117.18794,165.76985" + id="path1129-8" + inkscape:connector-curvature="0" + sodipodi:nodetypes="cc" /> + <path + style="fill:none;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-start:" + d="m 30.928217,152.75495 c 17.153463,-16.11386 50.940591,-9.09653 50.940591,-9.09653" + id="path14291" + inkscape:connector-curvature="0" + sodipodi:nodetypes="cc" /> + <path + style="fill:none;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="m 46.290469,208.6524 c 6.757426,13.25495 30.148513,13.77475 30.148513,13.77475" + id="path14337" + inkscape:connector-curvature="0" /> + <text + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.93888855px;line-height:1.25;font-family:Courier;-inkscape-font-specification:Courier;text-align:start;letter-spacing:0px;word-spacing:0px;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332" + x="4.938118" + y="198.4975" + id="text14341"><tspan + sodipodi:role="line" + id="tspan14339" + x="4.938118" + y="198.4975" + style="stroke-width:0.26458332">POST</tspan></text> + <text + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.93888855px;line-height:1.25;font-family:Courier;-inkscape-font-specification:Courier;text-align:start;letter-spacing:0px;word-spacing:0px;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332" + x="6.4756169" + y="170.42822" + id="text14345"><tspan + sodipodi:role="line" + id="tspan14343" + x="6.4756169" + y="170.42822" + style="stroke-width:0.26458332">GET</tspan></text> + <text + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.93888855px;line-height:1.25;font-family:Courier;-inkscape-font-specification:Courier;text-align:start;letter-spacing:0px;word-spacing:0px;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332" + x="122.41336" + y="162.8911" + id="text14349"><tspan + sodipodi:role="line" + id="tspan14347" + x="122.41336" + y="162.8911" + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:Courier;-inkscape-font-specification:'Courier Bold';stroke-width:0.26458332">/ingredients</tspan></text> + <text + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.93888855px;line-height:1.25;font-family:Courier;-inkscape-font-specification:Courier;text-align:start;letter-spacing:0px;word-spacing:0px;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332" + x="146.99071" + y="130.25659" + id="text14349-9"><tspan + sodipodi:role="line" + id="tspan14347-1" + x="146.99071" + y="130.25659" + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:Courier;-inkscape-font-specification:'Courier Bold';stroke-width:0.26458332">/api/v1</tspan></text> + <path + style="fill:none;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="m 234.43068,177.44555 c 10.39604,-8.31683 35.14282,3.63861 35.14282,3.63861" + id="path14369" + inkscape:connector-curvature="0" + sodipodi:nodetypes="cc" /> + <g + id="g14406" + transform="translate(66.702408,-73.292076)"> + <rect + ry="0" + y="254.37624" + x="202.87109" + height="13.774752" + width="15.594059" + id="rect14375" + style="opacity:1;fill:none;fill-opacity:0.92941176;stroke:#1a1a1a;stroke-width:0.46499997;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" /> + <path + inkscape:connector-curvature="0" + id="path14379" + d="m 203.131,258.79215 h 15.07425" + style="fill:none;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /> + <path + inkscape:connector-curvature="0" + id="path14379-5" + d="m 203.131,263.55468 h 15.07425" + style="fill:none;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /> + <path + sodipodi:nodetypes="cc" + inkscape:connector-curvature="0" + id="path14379-4" + d="m 210.66813,254.54246 v 12.99505" + style="fill:none;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /> + </g> + <path + style="fill:none;stroke:#000000;stroke-width:0.26458332;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:1.05833327,2.11666654;stroke-dashoffset:0" + d="m 124.75247,142.09901 c 20.53218,-8.31683 54.31931,-0.2599 54.31931,-0.2599" + id="path14408" + inkscape:connector-curvature="0" /> + <path + style="fill:none;stroke:#000000;stroke-width:0.26458332;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:1.5874999,1.5874999;stroke-dashoffset:0" + d="m 190.50742,157.43317 c 0.5198,37.16584 -8.83664,49.12128 -17.93317,54.5792 -9.09654,5.45792 -37.94554,10.65595 -37.94554,10.65595" + id="path14410" + inkscape:connector-curvature="0" + sodipodi:nodetypes="csc" /> + <path + style="fill:none;stroke:#000000;stroke-width:0.26458332;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:1.05833327,1.05833327;stroke-dashoffset:0" + d="m 198.82425,155.35396 c 12.47525,7.01733 14.81436,18.97278 14.81436,18.97278" + id="path14412" + inkscape:connector-curvature="0" /> + </g> +</svg> diff --git a/bin/pom.xml b/bin/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..727e9e25a71351db6a8e318bd0af200eeb688902 --- /dev/null +++ b/bin/pom.xml @@ -0,0 +1,163 @@ +<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 http://maven.apache.org/maven-v4_0_0.xsd"> + + <modelVersion>4.0.0</modelVersion> + + <groupId>fr.ulille.iut.pizzaland</groupId> + <artifactId>pizzaland_jdbi</artifactId> + <packaging>jar</packaging> + <version>1.0-SNAPSHOT</version> + <name>pizzaland_jdbi</name> + + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.glassfish.jersey</groupId> + <artifactId>jersey-bom</artifactId> + <version>${jersey.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + <dependency> + <groupId>org.jdbi</groupId> + <artifactId>jdbi3-bom</artifactId> + <type>pom</type> + <version>${jdbi.version}</version> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> + + <dependencies> + <dependency> + <groupId>org.glassfish.jersey.containers</groupId> + <artifactId>jersey-container-grizzly2-http</artifactId> + </dependency> + <dependency> + <groupId>org.glassfish.jersey.inject</groupId> + <artifactId>jersey-hk2</artifactId> + </dependency> + + <!-- uncomment this to get JSON support: --> + <dependency> + <groupId>org.glassfish.jersey.media</groupId> + <artifactId>jersey-media-json-binding</artifactId> + </dependency> + <!-- --> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.12</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.glassfish.jersey.test-framework.providers</groupId> + <artifactId>jersey-test-framework-provider-grizzly2</artifactId> + <version>${jersey.version}</version> + </dependency> + <!-- https://mvnrepository.com/artifact/org.xerial/sqlite-jdbc --> + <dependency> + <groupId>org.xerial</groupId> + <artifactId>sqlite-jdbc</artifactId> + <version>${sqlite-jdbc.version}</version> + </dependency> + <!-- https://mvnrepository.com/artifact/org.jdbi/jdbi3-core --> + <dependency> + <groupId>org.jdbi</groupId> + <artifactId>jdbi3-core</artifactId> + </dependency> + <dependency> + <groupId>org.jdbi</groupId> + <artifactId>jdbi3-sqlobject</artifactId> + </dependency> + <dependency> + <groupId>org.jdbi</groupId> + <artifactId>jdbi3-sqlite</artifactId> + </dependency> + <dependency> + <groupId>org.jdbi</groupId> + <artifactId>jdbi3-testing</artifactId> + <version>3.12.0</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>jakarta.xml.bind</groupId> + <artifactId>jakarta.xml.bind-api</artifactId> + <version>3.0.0</version> + </dependency> + <dependency> + <groupId>com.sun.xml.bind</groupId> + <artifactId>jaxb-impl</artifactId> + <version>3.0.0</version> + <scope>runtime</scope> + </dependency> + <!-- dependency> + <groupId></groupId> + <artifactId></artifactId> + <version></version> + </dependency--> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <version>3.8.1</version> + <inherited>true</inherited> + <configuration> + <release>11</release> + </configuration> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>exec-maven-plugin</artifactId> + <version>1.2.1</version> + <executions> + <execution> + <goals> + <goal>java</goal> + </goals> + </execution> + </executions> + <configuration> + <mainClass>fr.ulille.iut.pizzaland.Main</mainClass> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-shade-plugin</artifactId> + <version>${shade.version}</version> + <executions> + <execution> + <phase>package</phase> + <goals> + <goal>shade</goal> + </goals> + <configuration> + <transformers> + <transformer + implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> + <mainClass>fr.ulille.iut.pizzaland.Main</mainClass> + </transformer> + <transformer + implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" /> + </transformers> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> + + <properties> + <jersey.version>3.0.0</jersey.version> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <shade.version>3.2.4</shade.version> + <lombok.version>1.18.16</lombok.version> + <jdbi.version>3.16.0</jdbi.version> + <sqlite-jdbc.version>3.34.0</sqlite-jdbc.version> + <jaxb.version>2.4.0-b180830.0359</jaxb.version> + </properties> +</project> diff --git a/bin/src/main/java/fr/ulille/iut/pizzaland/ApiV1.class b/bin/src/main/java/fr/ulille/iut/pizzaland/ApiV1.class new file mode 100644 index 0000000000000000000000000000000000000000..8b65d451c34a08c3efd82cf634c55d77b62900a1 Binary files /dev/null and b/bin/src/main/java/fr/ulille/iut/pizzaland/ApiV1.class differ diff --git a/bin/src/main/java/fr/ulille/iut/pizzaland/BDDFactory.class b/bin/src/main/java/fr/ulille/iut/pizzaland/BDDFactory.class new file mode 100644 index 0000000000000000000000000000000000000000..acbca89019108638305794281d98599235d0aff6 Binary files /dev/null and b/bin/src/main/java/fr/ulille/iut/pizzaland/BDDFactory.class differ diff --git a/bin/src/main/java/fr/ulille/iut/pizzaland/Main.class b/bin/src/main/java/fr/ulille/iut/pizzaland/Main.class new file mode 100644 index 0000000000000000000000000000000000000000..743131675fb3658bdedb5007bfd51ab44355aed7 Binary files /dev/null and b/bin/src/main/java/fr/ulille/iut/pizzaland/Main.class differ diff --git a/bin/src/main/java/fr/ulille/iut/pizzaland/beans/.gitkeep b/bin/src/main/java/fr/ulille/iut/pizzaland/beans/.gitkeep new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/bin/src/main/java/fr/ulille/iut/pizzaland/dao/.gitkeep b/bin/src/main/java/fr/ulille/iut/pizzaland/dao/.gitkeep new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/bin/src/main/java/fr/ulille/iut/pizzaland/dao/UUIDArgument.class b/bin/src/main/java/fr/ulille/iut/pizzaland/dao/UUIDArgument.class new file mode 100644 index 0000000000000000000000000000000000000000..39cd3c891628f90bcf7e933b05694dc3b479cb56 Binary files /dev/null and b/bin/src/main/java/fr/ulille/iut/pizzaland/dao/UUIDArgument.class differ diff --git a/bin/src/main/java/fr/ulille/iut/pizzaland/dao/UUIDArgumentFactory.class b/bin/src/main/java/fr/ulille/iut/pizzaland/dao/UUIDArgumentFactory.class new file mode 100644 index 0000000000000000000000000000000000000000..c66b961477d717fea45b820759f110c3dea40826 Binary files /dev/null and b/bin/src/main/java/fr/ulille/iut/pizzaland/dao/UUIDArgumentFactory.class differ diff --git a/bin/src/main/java/fr/ulille/iut/pizzaland/dto/IngredientDto.class b/bin/src/main/java/fr/ulille/iut/pizzaland/dto/IngredientDto.class new file mode 100644 index 0000000000000000000000000000000000000000..e90678ab722be42c4381a388213dc2040bf677c6 Binary files /dev/null and b/bin/src/main/java/fr/ulille/iut/pizzaland/dto/IngredientDto.class differ diff --git a/bin/src/main/java/fr/ulille/iut/pizzaland/resources/BDDClearRessource.class b/bin/src/main/java/fr/ulille/iut/pizzaland/resources/BDDClearRessource.class new file mode 100644 index 0000000000000000000000000000000000000000..93b051485a9723be1de298597e5f660167e799dc Binary files /dev/null and b/bin/src/main/java/fr/ulille/iut/pizzaland/resources/BDDClearRessource.class differ diff --git a/bin/src/main/java/fr/ulille/iut/pizzaland/resources/IngredientResource.class b/bin/src/main/java/fr/ulille/iut/pizzaland/resources/IngredientResource.class new file mode 100644 index 0000000000000000000000000000000000000000..8fd0e2c4137569a7a7195610bf2bbe1309a232b9 Binary files /dev/null and b/bin/src/main/java/fr/ulille/iut/pizzaland/resources/IngredientResource.class differ diff --git a/bin/src/main/resources/ingredients.json b/bin/src/main/resources/ingredients.json new file mode 100644 index 0000000000000000000000000000000000000000..1dcc13bf14994920cf220d2bf4557181867be857 --- /dev/null +++ b/bin/src/main/resources/ingredients.json @@ -0,0 +1,14 @@ +[ +{ "id": "f38806a8-7c85-49ef-980c-149dcd81d306", "name": "mozzarella"}, +{ "id": "d36903e1-0cc0-4bd6-a0ed-e0e9bf7b4037", "name": "jambon"}, +{ "id": "bc5b315f-442f-4ee4-96de-486d48f20c2f", "name": "champignons"}, +{ "id": "6a04320c-3a4f-4570-96d3-61faf3f898b0", "name": "olives"}, +{ "id": "c77deeee-d50d-49d5-9695-c98ec811f762", "name": "tomate"}, +{ "id": "c9375542-8142-43f6-b54d-0d63597cf614", "name": "merguez"}, +{ "id": "dee27dd6-f9b6-4d03-ac4b-216b5c9c8bd7", "name": "lardons"}, +{ "id": "657f8dd4-6bc1-4622-9af7-37d248846a23", "name": "fromage"}, +{ "id": "070d8077-a713-49a0-af37-3936b63d5ff2", "name": "oeuf"}, +{ "id": "5d9ca5c4-517f-40fd-aac3-5a823d680c1d", "name": "poivrons"}, +{ "id": "52f68024-24ec-46c0-8e77-c499dba1e27e", "name": "ananas"}, +{ "id": "dfdf6fae-f1b2-45fa-8c39-54e522c1933f", "name": "reblochon"} +] diff --git a/bin/src/main/resources/logging.properties b/bin/src/main/resources/logging.properties new file mode 100644 index 0000000000000000000000000000000000000000..db98114d366d9a6bfef0f729d08b24b09827227a --- /dev/null +++ b/bin/src/main/resources/logging.properties @@ -0,0 +1,4 @@ +handlers= java.util.logging.ConsoleHandler +.level= INFO +java.util.logging.ConsoleHandler.level = INFO +java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter \ No newline at end of file diff --git a/bin/src/test/java/fr/ulille/iut/pizzaland/IngredientResourceTest.class b/bin/src/test/java/fr/ulille/iut/pizzaland/IngredientResourceTest.class new file mode 100644 index 0000000000000000000000000000000000000000..ebef1ae878ad3d33970b8588ea9aa2f3b0e8c960 Binary files /dev/null and b/bin/src/test/java/fr/ulille/iut/pizzaland/IngredientResourceTest.class differ diff --git a/bin/src/test/resources/logging.properties b/bin/src/test/resources/logging.properties new file mode 100644 index 0000000000000000000000000000000000000000..db98114d366d9a6bfef0f729d08b24b09827227a --- /dev/null +++ b/bin/src/test/resources/logging.properties @@ -0,0 +1,4 @@ +handlers= java.util.logging.ConsoleHandler +.level= INFO +java.util.logging.ConsoleHandler.level = INFO +java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter \ No newline at end of file diff --git a/bin/target/classes/META-INF/MANIFEST.MF b/bin/target/classes/META-INF/MANIFEST.MF new file mode 100644 index 0000000000000000000000000000000000000000..a9dd0363c24b0b65a46cdc6e1c70ef96953b5bdd --- /dev/null +++ b/bin/target/classes/META-INF/MANIFEST.MF @@ -0,0 +1,5 @@ +Manifest-Version: 1.0 +Built-By: lepages +Build-Jdk: 11.0.9.1 +Created-By: Maven Integration for Eclipse + diff --git a/src/main/java/fr/ulille/iut/pizzaland/beans/Commande.java b/src/main/java/fr/ulille/iut/pizzaland/beans/Commande.java new file mode 100644 index 0000000000000000000000000000000000000000..ff528638f80eb0c87a24b32e3b003796f94677f7 --- /dev/null +++ b/src/main/java/fr/ulille/iut/pizzaland/beans/Commande.java @@ -0,0 +1,120 @@ +package fr.ulille.iut.pizzaland.beans; + +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; + +import fr.ulille.iut.pizzaland.dto.CommandeCreateDto; +import fr.ulille.iut.pizzaland.dto.CommandeDto; + +public class Commande { + private UUID id = UUID.randomUUID(); + private String nom; + private String prenom; + private List<Pizza> pizzas=new ArrayList<>(); + public UUID getId() { + return id; + } + public void setId(UUID id) { + this.id = id; + } + public String getNom() { + return nom; + } + public void setNom(String nom) { + this.nom = nom; + } + public String getPrenom() { + return prenom; + } + public void setPrenom(String prenom) { + this.prenom = prenom; + } + public List<Pizza> getPizzas() { + return pizzas; + } + public void setPizzas(List<Pizza> pizzas) { + this.pizzas = pizzas; + } + @Override + public String toString() { + return "Commande [id=" + id + ", nom=" + nom + ", prenom=" + prenom + ", pizzas=" + pizzas + "]"; + } + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((id == null) ? 0 : id.hashCode()); + result = prime * result + ((nom == null) ? 0 : nom.hashCode()); + result = prime * result + ((pizzas == null) ? 0 : pizzas.hashCode()); + result = prime * result + ((prenom == null) ? 0 : prenom.hashCode()); + return result; + } + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + Commande other = (Commande) obj; + if (id == null) { + if (other.id != null) + return false; + } else if (!id.equals(other.id)) + return false; + if (nom == null) { + if (other.nom != null) + return false; + } else if (!nom.equals(other.nom)) + return false; + if (pizzas == null) { + if (other.pizzas != null) + return false; + } else if (!pizzas.equals(other.pizzas)) + return false; + if (prenom == null) { + if (other.prenom != null) + return false; + } else if (!prenom.equals(other.prenom)) + return false; + return true; + } + + public static Commande fromDto(CommandeDto dto) { + Commande commande = new Commande(); + commande.setId(dto.getId()); + commande.setNom(dto.getNom()); + commande.setPrenom(dto.getPrenom()); + commande.setPizzas(dto.getPizzas()); + + return commande; + } + + public static CommandeDto toDto(Commande c) { + CommandeDto dto = new CommandeDto(); + dto.setId(c.getId()); + dto.setNom(c.getNom()); + dto.setPrenom(c.getPrenom()); + dto.setPizzas(c.getPizzas()); + return dto; + } + + public static Commande fromCommandeCreateDto(CommandeCreateDto commandeCreateDto) { + Commande commande = new Commande(); + commande.setNom(commandeCreateDto.getNom()); + commande.setPrenom(commandeCreateDto.getPrenom()); + + return commande; + } + public static CommandeCreateDto toCreateDto(Commande commande) { + CommandeCreateDto dto = new CommandeCreateDto(); + dto.setNom(commande.getNom()); + dto.setPrenom(commande.getPrenom()); + + + return dto; + } + +} \ No newline at end of file diff --git a/src/main/java/fr/ulille/iut/pizzaland/dao/CommandeDao.java b/src/main/java/fr/ulille/iut/pizzaland/dao/CommandeDao.java new file mode 100644 index 0000000000000000000000000000000000000000..29d80776a11151e8bec7a8fc71b70f6599bd7290 --- /dev/null +++ b/src/main/java/fr/ulille/iut/pizzaland/dao/CommandeDao.java @@ -0,0 +1,99 @@ +package fr.ulille.iut.pizzaland.dao; + +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; + +import org.jdbi.v3.sqlobject.config.RegisterBeanMapper; +import org.jdbi.v3.sqlobject.customizer.Bind; +import org.jdbi.v3.sqlobject.customizer.BindBean; +import org.jdbi.v3.sqlobject.statement.SqlQuery; +import org.jdbi.v3.sqlobject.statement.SqlUpdate; +import org.jdbi.v3.sqlobject.transaction.Transaction; + +import fr.ulille.iut.pizzaland.BDDFactory; +import fr.ulille.iut.pizzaland.beans.Commande; +import fr.ulille.iut.pizzaland.beans.Pizza; + +public interface CommandeDao { + + @SqlUpdate("CREATE TABLE IF NOT EXISTS Commande (id Varchar PRIMARY KEY, nom Varchar UNIQUE NOT NULL,prenom Varchar UNIQUE NOT NULL)") + void createCommandeTable(); + + @SqlUpdate("CREATE TABLE IF NOT EXISTS PizzaCommandeAssociation (pizzaID VARCHAR(128), commandeID VARCHAR(128), PRIMARY KEY(pizzaID, commandeID))") + void createTablePizzaAssociation(); + + @SqlUpdate("DROP TABLE IF EXISTS PizzaCommandeAssociation") + void dropTable(); + + @SqlUpdate("DROP TABLE IF EXISTS Commande") + void dropCommandeTable(); + + @SqlUpdate("INSERT INTO Commande (id, nom, prenom) VALUES (:id, :nom, :prenom)") + void insert(@BindBean Commande commande); + + @SqlUpdate("INSERT INTO PizzaCommandeAssociation (pizzaID,commandeID) VALUES( :pizza.id, :commande.id)") + void insertPizzaAssociation(@BindBean("pizza") Pizza pizza ,@BindBean("commande") Commande commande); + + @Transaction + default void createCommandeAndPizzaAssociation() { + createTablePizzaAssociation(); + createCommandeTable(); + } + @Transaction + default void dropCommandeAndPizzaAssociation() { + dropCommandeTable(); + dropTable(); + } + + @SqlQuery("SELECT * FROM Commande") + @RegisterBeanMapper(Commande.class) + List<Commande> getAll(); + + @SqlQuery("SELECT * FROM Commande WHERE id = :id") + @RegisterBeanMapper(Commande.class) + Commande findById(@Bind("id") UUID id); + + @SqlQuery("SELECT * FROM Commande WHERE nom = :nom") + @RegisterBeanMapper(Commande.class) + Commande findByName(@Bind("nom")String nom); + + @SqlUpdate("DELETE FROM Commande WHERE id = :id") + void remove(@Bind("id") UUID id); + + @SqlQuery("Select * from Pizza where id in(SELECT pizzaID FROM PizzaCommandeAssociation WHERE commandeID = :id)") + @RegisterBeanMapper(Pizza.class) + List<Pizza> findPizzaById(@Bind("id") UUID id); + + default void insertTablePizzaAndCommandeAssociation(Commande commande) { + this.insert(commande); + for(Pizza pizza : commande.getPizzas()) { + this.insertPizzaAssociation(pizza,commande); + } + } + @SqlQuery("SELECT pizzaId FROM PizzaCommandeAssociation where commandeID=:idCommande") + @RegisterBeanMapper(Commande.class) + List<UUID> getAllPizzaID(@Bind("idCommande") UUID idCommande); + + @Transaction + default List<Pizza> getAllPizza(List<UUID> idPizzas){ + PizzaDao pizzas = BDDFactory.buildDao(PizzaDao.class); + List<Pizza> pizza=new ArrayList<>(); + for(UUID id: idPizzas) { + pizza.add(pizzas.getTableAndIngredientAssociation(id)); + } + return pizza; + } + + @Transaction + default Commande getCommandeAndPizzaAssociation(UUID id) { + Commande commande=findById(id); + try{ + List<UUID> pizzaID=getAllPizzaID(id); + commande.setPizzas(getAllPizza(pizzaID)); + }catch(Exception e) {e.printStackTrace();} + return commande; + } + + +} \ No newline at end of file diff --git a/src/main/java/fr/ulille/iut/pizzaland/dto/CommandeCreateDto.java b/src/main/java/fr/ulille/iut/pizzaland/dto/CommandeCreateDto.java new file mode 100644 index 0000000000000000000000000000000000000000..76471af12608a9c45cf23ae835987da3559f9dc3 --- /dev/null +++ b/src/main/java/fr/ulille/iut/pizzaland/dto/CommandeCreateDto.java @@ -0,0 +1,24 @@ +package fr.ulille.iut.pizzaland.dto; + +public class CommandeCreateDto { + private String nom; + private String prenom; + + public String getPrenom() { + return prenom; + } + + public void setPrenom(String prenom) { + this.prenom = prenom; + } + + public CommandeCreateDto() {} + + public void setNom(String name) { + this.nom = name; + } + + public String getNom() { + return nom; + } +} \ No newline at end of file diff --git a/src/main/java/fr/ulille/iut/pizzaland/dto/CommandeDto.java b/src/main/java/fr/ulille/iut/pizzaland/dto/CommandeDto.java new file mode 100644 index 0000000000000000000000000000000000000000..daf48be7248c4b4ecd8c902075be3c256c71f02b --- /dev/null +++ b/src/main/java/fr/ulille/iut/pizzaland/dto/CommandeDto.java @@ -0,0 +1,38 @@ +package fr.ulille.iut.pizzaland.dto; + +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; + +import fr.ulille.iut.pizzaland.beans.Pizza; + +public class CommandeDto { + private UUID id; + private String nom; + private String prenom; + private List<Pizza> pizzas=new ArrayList<>(); + public UUID getId() { + return id; + } + public void setId(UUID id) { + this.id = id; + } + public String getNom() { + return nom; + } + public void setNom(String nom) { + this.nom = nom; + } + public String getPrenom() { + return prenom; + } + public void setPrenom(String prenom) { + this.prenom = prenom; + } + public List<Pizza> getPizzas() { + return pizzas; + } + public void setPizzas(List<Pizza> pizzas) { + this.pizzas = pizzas; + } +} \ No newline at end of file diff --git a/src/main/java/fr/ulille/iut/pizzaland/dto/PizzaCreateDto.java b/src/main/java/fr/ulille/iut/pizzaland/dto/PizzaCreateDto.java index 8a7273a1d61f8195298aba55cc44cbeb568e36fe..87495ba20feeeabf5021e298c0b71824d1f7b0fa 100644 --- a/src/main/java/fr/ulille/iut/pizzaland/dto/PizzaCreateDto.java +++ b/src/main/java/fr/ulille/iut/pizzaland/dto/PizzaCreateDto.java @@ -1,7 +1,5 @@ package fr.ulille.iut.pizzaland.dto; -import java.util.UUID; - public class PizzaCreateDto { private String name; diff --git a/src/main/java/fr/ulille/iut/pizzaland/resources/CommandeRessource.java b/src/main/java/fr/ulille/iut/pizzaland/resources/CommandeRessource.java new file mode 100644 index 0000000000000000000000000000000000000000..571c4860e5f814de2c21a381be3ee192e756f68b --- /dev/null +++ b/src/main/java/fr/ulille/iut/pizzaland/resources/CommandeRessource.java @@ -0,0 +1,108 @@ +package fr.ulille.iut.pizzaland.resources; + +import java.net.URI; +import java.util.List; +import java.util.UUID; +import java.util.logging.Logger; +import java.util.stream.Collectors; + +import fr.ulille.iut.pizzaland.BDDFactory; +import fr.ulille.iut.pizzaland.beans.Commande; +import fr.ulille.iut.pizzaland.dao.CommandeDao; +import fr.ulille.iut.pizzaland.dto.CommandeCreateDto; +import fr.ulille.iut.pizzaland.dto.CommandeDto; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.DELETE; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.PathParam; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.WebApplicationException; +import jakarta.ws.rs.core.Context; +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.UriInfo; + +@Consumes("application/json") +@Path("/commandes") +public class CommandeRessource { + private static final Logger LOGGER = Logger.getLogger(CommandeRessource.class.getName()); + + private CommandeDao commandes; + + @Context + public UriInfo uriInfo; + + public CommandeRessource() { + commandes = BDDFactory.buildDao(CommandeDao.class); + commandes.createTablePizzaAssociation(); + } + + @GET + public List<CommandeDto> getAll() { + LOGGER.info("CommandeRessource:getAll"); + + List<CommandeDto> l = commandes.getAll().stream().map(Commande::toDto).collect(Collectors.toList()); + LOGGER.info(l.toString()); + return l; + } + + @GET + @Path("{id}") + @Produces({ "application/json", "application/xml" }) + public CommandeDto getOneCommande(@PathParam("id") UUID id) { + LOGGER.info("getOneCommande(" + id + ")"); + try { + Commande commande = commandes.getCommandeAndPizzaAssociation(id); + LOGGER.info(commande.toString()); + return Commande.toDto(commande); + } catch (Exception e) { + throw new WebApplicationException(Response.Status.NOT_FOUND); + } + } + + @POST + public Response createCommande(CommandeCreateDto commandeCreateDto) { + Commande existing = commandes.findByName(commandeCreateDto.getNom()); + if (existing != null) { + throw new WebApplicationException(Response.Status.CONFLICT); + } + + try { + Commande commande = Commande.fromCommandeCreateDto(commandeCreateDto); + commandes.insert(commande); + CommandeDto commandeDto = Commande.toDto(commande); + System.out.println(commande.getId().toString()); + URI uri = uriInfo.getAbsolutePathBuilder().path(commande.getId().toString()).build(); + + return Response.created(uri).entity(commandeDto).build(); + } catch (Exception e) { + e.printStackTrace(); + throw new WebApplicationException(Response.Status.NOT_ACCEPTABLE); + } + + } + @DELETE + @Path("{id}") + public Response deleteCommande(@PathParam("id") UUID id) { + if ( commandes.findById(id) == null ) { + throw new WebApplicationException(Response.Status.NOT_FOUND); + } + + commandes.remove(id); + + return Response.status(Response.Status.ACCEPTED).build(); + } + @GET + @Path("{id}/nom") + public String getCommandeNom(@PathParam("id") UUID id) { + Commande commande = commandes.findById(id); + + if (commande == null) { + throw new WebApplicationException(Response.Status.NOT_FOUND); + } + + return commande.getNom(); + } + +} \ No newline at end of file diff --git a/src/main/java/fr/ulille/iut/pizzaland/resources/PizzaRessource.java b/src/main/java/fr/ulille/iut/pizzaland/resources/PizzaRessource.java index 5ac24ca5202965f3dee367d572081c96c072f6f4..d8f98ecb2d76326527c6f6abeb4d8855b1a3c5a6 100644 --- a/src/main/java/fr/ulille/iut/pizzaland/resources/PizzaRessource.java +++ b/src/main/java/fr/ulille/iut/pizzaland/resources/PizzaRessource.java @@ -7,11 +7,8 @@ import java.util.logging.Logger; import java.util.stream.Collectors; import fr.ulille.iut.pizzaland.BDDFactory; -import fr.ulille.iut.pizzaland.beans.Ingredient; import fr.ulille.iut.pizzaland.beans.Pizza; import fr.ulille.iut.pizzaland.dao.PizzaDao; -import fr.ulille.iut.pizzaland.dto.IngredientCreateDto; -import fr.ulille.iut.pizzaland.dto.IngredientDto; import fr.ulille.iut.pizzaland.dto.PizzaCreateDto; import fr.ulille.iut.pizzaland.dto.PizzaDto; import jakarta.ws.rs.Consumes; @@ -29,7 +26,7 @@ import jakarta.ws.rs.core.UriInfo; @Consumes("application/json") @Path("/pizzas") public class PizzaRessource { - private static final Logger LOGGER = Logger.getLogger(PizzaRessource.class.getName()); + private static final Logger LOG = Logger.getLogger(PizzaRessource.class.getName()); private PizzaDao pizzas; @@ -43,20 +40,20 @@ public class PizzaRessource { @GET public List<PizzaDto> getAll() { - LOGGER.info("PizzaRessource:getAll"); + LOG.info("PizzaRessource:getAll"); List<PizzaDto> l = pizzas.getAll().stream().map(Pizza::toDto).collect(Collectors.toList()); - LOGGER.info(l.toString()); + LOG.info(l.toString()); return l; } @GET @Path("{id}") @Produces({ "application/json", "application/xml" }) public PizzaDto getOnePizza(@PathParam("id") UUID id) { - LOGGER.info("getOnePizza(" + id + ")"); + LOG.info("getOnePizza(" + id + ")"); try { Pizza pizza = pizzas.getTableAndIngredientAssociation(id); - LOGGER.info(pizza.toString()); + LOG.info(pizza.toString()); return Pizza.toDto(pizza); } catch (Exception e) { throw new WebApplicationException(Response.Status.NOT_FOUND); diff --git a/src/test/java/fr/ulille/iut/pizzaland/CommandeRessourceTest.java b/src/test/java/fr/ulille/iut/pizzaland/CommandeRessourceTest.java new file mode 100644 index 0000000000000000000000000000000000000000..bb0933b478ea0dc9f84d43dace94e61e763c7874 --- /dev/null +++ b/src/test/java/fr/ulille/iut/pizzaland/CommandeRessourceTest.java @@ -0,0 +1,193 @@ +package fr.ulille.iut.pizzaland; + +import static org.junit.Assert.assertEquals; + +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; + +import org.glassfish.jersey.test.JerseyTest; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import fr.ulille.iut.pizzaland.beans.Commande; +import fr.ulille.iut.pizzaland.beans.Ingredient; +import fr.ulille.iut.pizzaland.beans.Pizza; +import fr.ulille.iut.pizzaland.dao.CommandeDao; +import fr.ulille.iut.pizzaland.dao.IngredientDao; +import fr.ulille.iut.pizzaland.dao.PizzaDao; +import fr.ulille.iut.pizzaland.dto.CommandeCreateDto; +import fr.ulille.iut.pizzaland.dto.CommandeDto; +import jakarta.ws.rs.client.Entity; +import jakarta.ws.rs.core.Application; +import jakarta.ws.rs.core.GenericType; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; + +public class CommandeRessourceTest extends JerseyTest { + private CommandeDao dao; + private PizzaDao pizzadao; + private IngredientDao ingredientdao; + + @Override + protected Application configure() { + return new ApiV1(); + } + + @Before + public void setEnvUp() { + dao = BDDFactory.buildDao(CommandeDao.class); + pizzadao=BDDFactory.buildDao(PizzaDao.class); + ingredientdao =BDDFactory.buildDao(IngredientDao.class); + ingredientdao.createTable(); + dao.createCommandeAndPizzaAssociation(); + pizzadao.createTableAndIngredientAssociation(); + } + + @After + public void tearEnvDown() throws Exception { + dao.dropCommandeAndPizzaAssociation(); + ingredientdao.dropTable(); + pizzadao.dropTableAndIngredientAssociation(); + } + + + @Test + public void testGetEmptyList() { + Response response = target("/commandes").request().get(); + + // Vérification de la valeur de retour (200) + assertEquals(Response.Status.OK.getStatusCode(), response.getStatus()); + + // Vérification de la valeur retournée (liste vide) + List<CommandeDto> commande; + commande = response.readEntity(new GenericType<List<CommandeDto>>(){}); + + assertEquals(0, commande.size()); + } + + @Test + public void testGetExistingCommande() { + Commande commande=new Commande(); + commande.setNom("Paul"); + commande.setPrenom("Jean"); + dao.insert(commande); + + Response response = target("/commandes").path(commande.getId().toString()).request(MediaType.APPLICATION_JSON).get(); + + assertEquals(Response.Status.OK.getStatusCode(), response.getStatus()); + + Commande result = Commande.fromDto(response.readEntity(CommandeDto.class)); + assertEquals(commande, result); + } + + @Test + public void testGetNotExistingCommande() { + Response response = target("/commandes").path(UUID.randomUUID().toString()).request().get(); + assertEquals(Response.Status.NOT_FOUND.getStatusCode(),response.getStatus()); + } + + @Test + public void testCreateCommande() { + CommandeCreateDto commandeCreateDto = new CommandeCreateDto(); + commandeCreateDto.setNom("Paul"); + commandeCreateDto.setPrenom("Jean"); + + Response response = target("/commandes").request().post(Entity.json(commandeCreateDto)); + + assertEquals(Response.Status.CREATED.getStatusCode(), response.getStatus()); + + CommandeDto returnedEntity = response.readEntity(CommandeDto.class); + + assertEquals(target("/commandes/" + returnedEntity.getId()).getUri(), response.getLocation()); + assertEquals(returnedEntity.getNom(), commandeCreateDto.getNom()); + assertEquals(returnedEntity.getPrenom(), commandeCreateDto.getPrenom()); + + } + @Test + public void testCreateSameCommande() { + Commande commande = new Commande(); + commande.setNom("Paul"); + commande.setPrenom("Jean"); + dao.insert(commande); + + CommandeCreateDto commandeCreateDto = Commande.toCreateDto(commande); + Response response = target("/commandes").request().post(Entity.json(commandeCreateDto)); + + assertEquals(Response.Status.CONFLICT.getStatusCode(), response.getStatus()); + } + @Test + public void testCreateCommandeWithoutName() { + CommandeCreateDto commandeCreateDto = new CommandeCreateDto(); + + Response response = target("/commandes").request().post(Entity.json(commandeCreateDto)); + + assertEquals(Response.Status.NOT_ACCEPTABLE.getStatusCode(), response.getStatus()); + } + @Test + public void testDeleteExistingCommande() { + Commande commande = new Commande(); + commande.setNom("Paul"); + commande.setPrenom("Jean"); + dao.insert(commande); + + Response response = target("/commandes/").path(commande.getId().toString()).request().delete(); + + assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatus()); + + Commande result = dao.findById(commande.getId()); + assertEquals(result, null); + } + @Test + public void testDeleteNotExistingCommande() { + Response response = target("/commandes").path(UUID.randomUUID().toString()).request().delete(); + assertEquals(Response.Status.NOT_FOUND.getStatusCode(), response.getStatus()); + } + @Test + public void testGetCommandeNomAndPrenom() { + Commande commande = new Commande(); + commande.setNom("Paul"); + commande.setPrenom("Jean"); + dao.insert(commande); + + Response response = target("commandes").path(commande.getId().toString()).path("nom").request().get(); + + assertEquals(Response.Status.OK.getStatusCode(), response.getStatus()); + + assertEquals("Paul", response.readEntity(String.class)); + } + @Test + public void testGetNotExistingCommandeNom() { + Response response = target("commandes").path(UUID.randomUUID().toString()).path("nom").request().get(); + + assertEquals(Response.Status.NOT_FOUND.getStatusCode(), response.getStatus()); + } + @Test + public void testGetExistingCommandeWithPizza() { + Commande commande = new Commande(); + commande.setNom("Paul"); + commande.setPrenom("Jean"); + Pizza p=new Pizza(); + p.setName("Norvegienne"); + Ingredient Saumon=new Ingredient(); + Saumon.setName("Saumon"); + ingredientdao.insert(Saumon); + List<Ingredient> ingredient=new ArrayList<>(); + ingredient.add(Saumon); + p.setIngredients(ingredient); + pizzadao.insertTablePizzaAndIngredientAssociation(p); + List<Pizza> pizzas=new ArrayList<>(); + pizzas.add(p); + commande.setPizzas(pizzas); + dao.insertTablePizzaAndCommandeAssociation(commande); + + Response response = target("/commandes").path(commande.getId().toString()).request(MediaType.APPLICATION_JSON).get(); + + assertEquals(Response.Status.OK.getStatusCode(), response.getStatus()); + + Commande result = Commande.fromDto(response.readEntity(CommandeDto.class)); + assertEquals(commande, result); + } + +} diff --git a/src/test/java/fr/ulille/iut/pizzaland/IngredientResourceTest.java b/src/test/java/fr/ulille/iut/pizzaland/IngredientResourceTest.java index e8153f1cbe97d7c4f5265d08102c9ca69221929c..23aa21c1f9a89bfec35dd55214e92a11ceccbfcd 100644 --- a/src/test/java/fr/ulille/iut/pizzaland/IngredientResourceTest.java +++ b/src/test/java/fr/ulille/iut/pizzaland/IngredientResourceTest.java @@ -1,11 +1,9 @@ package fr.ulille.iut.pizzaland; -import fr.ulille.iut.pizzaland.ApiV1; import fr.ulille.iut.pizzaland.dto.IngredientCreateDto; import fr.ulille.iut.pizzaland.dto.IngredientDto; import org.glassfish.jersey.test.JerseyTest; -import org.glassfish.jersey.test.TestProperties; import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -32,7 +30,7 @@ import fr.ulille.iut.pizzaland.dao.IngredientDao; * la méthode configure() permet de démarrer la ressource à tester */ public class IngredientResourceTest extends JerseyTest { - private static final Logger LOGGER = Logger.getLogger(IngredientResourceTest.class.getName()); + private static final Logger LOG = Logger.getLogger(IngredientResourceTest.class.getName()); private IngredientDao dao; @Override @@ -85,7 +83,7 @@ public class IngredientResourceTest extends JerseyTest { @Test public void testGetExistingIngredient() { Ingredient ingredient = new Ingredient(); - ingredient.setName("Chorizo"); + ingredient.setName("Saumon"); dao.insert(ingredient); Response response = target("/ingredients").path(ingredient.getId().toString()).request(MediaType.APPLICATION_JSON).get(); @@ -105,7 +103,7 @@ public class IngredientResourceTest extends JerseyTest { @Test public void testCreateIngredient() { IngredientCreateDto ingredientCreateDto = new IngredientCreateDto(); - ingredientCreateDto.setName("Chorizo"); + ingredientCreateDto.setName("Saumon"); Response response = target("/ingredients").request().post(Entity.json(ingredientCreateDto)); @@ -120,7 +118,7 @@ public class IngredientResourceTest extends JerseyTest { @Test public void testCreateSameIngredient() { Ingredient ingredient = new Ingredient(); - ingredient.setName("Chorizo"); + ingredient.setName("Saumon"); dao.insert(ingredient); IngredientCreateDto ingredientCreateDto = Ingredient.toCreateDto(ingredient); @@ -141,7 +139,7 @@ public class IngredientResourceTest extends JerseyTest { @Test public void testDeleteExistingIngredient() { Ingredient ingredient = new Ingredient(); - ingredient.setName("Chorizo"); + ingredient.setName("Saumon"); dao.insert(ingredient); Response response = target("/ingredients/").path(ingredient.getId().toString()).request().delete(); @@ -161,14 +159,14 @@ public class IngredientResourceTest extends JerseyTest { @Test public void testGetIngredientName() { Ingredient ingredient = new Ingredient(); - ingredient.setName("Chorizo"); + ingredient.setName("Saumon"); dao.insert(ingredient); Response response = target("ingredients").path(ingredient.getId().toString()).path("name").request().get(); assertEquals(Response.Status.OK.getStatusCode(), response.getStatus()); - assertEquals("Chorizo", response.readEntity(String.class)); + assertEquals("Saumon", response.readEntity(String.class)); } @Test @@ -181,7 +179,7 @@ public class IngredientResourceTest extends JerseyTest { @Test public void testCreateWithForm() { Form form = new Form(); - form.param("name", "chorizo"); + form.param("name", "Saumon"); Entity<Form> formEntity = Entity.entity(form, MediaType.APPLICATION_FORM_URLENCODED_TYPE); Response response = target("ingredients").request().post(formEntity); diff --git a/src/test/java/fr/ulille/iut/pizzaland/PizzaRessourceTest.java b/src/test/java/fr/ulille/iut/pizzaland/PizzaRessourceTest.java index 9684458ec2d33bfc82a30a63721fdf0d11d54e7b..a9dfe926d1e18c7ec006917283e46c4833380ee5 100644 --- a/src/test/java/fr/ulille/iut/pizzaland/PizzaRessourceTest.java +++ b/src/test/java/fr/ulille/iut/pizzaland/PizzaRessourceTest.java @@ -64,7 +64,7 @@ public class PizzaRessourceTest extends JerseyTest{ @Test public void testGetExistingPizza() { Pizza p=new Pizza(); - p.setName("Espagnole"); + p.setName("Norvegienne"); dao.insert(p); Response response = target("/pizzas").path(p.getId().toString()).request(MediaType.APPLICATION_JSON).get(); @@ -82,7 +82,7 @@ public class PizzaRessourceTest extends JerseyTest{ @Test public void testCreatePizza() { PizzaCreateDto pizzaCreateDto = new PizzaCreateDto(); - pizzaCreateDto.setName("Chorizo"); + pizzaCreateDto.setName("Saumon"); Response response = target("/pizzas").request().post(Entity.json(pizzaCreateDto)); @@ -96,7 +96,7 @@ public class PizzaRessourceTest extends JerseyTest{ @Test public void testCreateSamePizza() { Pizza pizza = new Pizza(); - pizza.setName("Chorizo"); + pizza.setName("Saumon"); dao.insert(pizza); PizzaCreateDto pizzaCreateDto = Pizza.toCreateDto(pizza); @@ -115,7 +115,7 @@ public class PizzaRessourceTest extends JerseyTest{ @Test public void testDeleteExistingPizza() { Pizza pizza = new Pizza(); - pizza.setName("Chorizo"); + pizza.setName("Saumon"); dao.insert(pizza); Response response = target("/pizzas/").path(pizza.getId().toString()).request().delete(); @@ -133,14 +133,14 @@ public class PizzaRessourceTest extends JerseyTest{ @Test public void testGetPizzaName() { Pizza pizza = new Pizza(); - pizza.setName("Chorizo"); + pizza.setName("Saumon"); dao.insert(pizza); Response response = target("pizzas").path(pizza.getId().toString()).path("name").request().get(); assertEquals(Response.Status.OK.getStatusCode(), response.getStatus()); - assertEquals("Chorizo", response.readEntity(String.class)); + assertEquals("Saumon", response.readEntity(String.class)); } @Test public void testGetNotExistingPizzaName() { @@ -151,12 +151,12 @@ public class PizzaRessourceTest extends JerseyTest{ @Test public void testGetExistingPizzaWithIngredients() { Pizza p=new Pizza(); - p.setName("Espagnole"); - Ingredient chorizo=new Ingredient(); - chorizo.setName("Chorizo"); - idao.insert(chorizo); + p.setName("Norvegienne"); + Ingredient Saumon=new Ingredient(); + Saumon.setName("Saumon"); + idao.insert(Saumon); List<Ingredient> ingredient=new ArrayList<>(); - ingredient.add(chorizo); + ingredient.add(Saumon); p.setIngredients(ingredient); dao.insertTablePizzaAndIngredientAssociation(p); diff --git a/target/classes/META-INF/MANIFEST.MF b/target/classes/META-INF/MANIFEST.MF new file mode 100644 index 0000000000000000000000000000000000000000..a9dd0363c24b0b65a46cdc6e1c70ef96953b5bdd --- /dev/null +++ b/target/classes/META-INF/MANIFEST.MF @@ -0,0 +1,5 @@ +Manifest-Version: 1.0 +Built-By: lepages +Build-Jdk: 11.0.9.1 +Created-By: Maven Integration for Eclipse + diff --git a/target/classes/META-INF/maven/fr.ulille.iut.pizzaland/pizzaland_jdbi/pom.properties b/target/classes/META-INF/maven/fr.ulille.iut.pizzaland/pizzaland_jdbi/pom.properties new file mode 100644 index 0000000000000000000000000000000000000000..c564727b337dc914dae8d407aac562116228001c --- /dev/null +++ b/target/classes/META-INF/maven/fr.ulille.iut.pizzaland/pizzaland_jdbi/pom.properties @@ -0,0 +1,7 @@ +#Generated by Maven Integration for Eclipse +#Tue Mar 09 09:15:51 CET 2021 +m2e.projectLocation=/home/infoetu/lepages/Prog_rep/m4102_tp3 +m2e.projectName=m4102_tp3 +groupId=fr.ulille.iut.pizzaland +artifactId=pizzaland_jdbi +version=1.0-SNAPSHOT diff --git a/target/classes/META-INF/maven/fr.ulille.iut.pizzaland/pizzaland_jdbi/pom.xml b/target/classes/META-INF/maven/fr.ulille.iut.pizzaland/pizzaland_jdbi/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..727e9e25a71351db6a8e318bd0af200eeb688902 --- /dev/null +++ b/target/classes/META-INF/maven/fr.ulille.iut.pizzaland/pizzaland_jdbi/pom.xml @@ -0,0 +1,163 @@ +<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 http://maven.apache.org/maven-v4_0_0.xsd"> + + <modelVersion>4.0.0</modelVersion> + + <groupId>fr.ulille.iut.pizzaland</groupId> + <artifactId>pizzaland_jdbi</artifactId> + <packaging>jar</packaging> + <version>1.0-SNAPSHOT</version> + <name>pizzaland_jdbi</name> + + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.glassfish.jersey</groupId> + <artifactId>jersey-bom</artifactId> + <version>${jersey.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + <dependency> + <groupId>org.jdbi</groupId> + <artifactId>jdbi3-bom</artifactId> + <type>pom</type> + <version>${jdbi.version}</version> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> + + <dependencies> + <dependency> + <groupId>org.glassfish.jersey.containers</groupId> + <artifactId>jersey-container-grizzly2-http</artifactId> + </dependency> + <dependency> + <groupId>org.glassfish.jersey.inject</groupId> + <artifactId>jersey-hk2</artifactId> + </dependency> + + <!-- uncomment this to get JSON support: --> + <dependency> + <groupId>org.glassfish.jersey.media</groupId> + <artifactId>jersey-media-json-binding</artifactId> + </dependency> + <!-- --> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.12</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.glassfish.jersey.test-framework.providers</groupId> + <artifactId>jersey-test-framework-provider-grizzly2</artifactId> + <version>${jersey.version}</version> + </dependency> + <!-- https://mvnrepository.com/artifact/org.xerial/sqlite-jdbc --> + <dependency> + <groupId>org.xerial</groupId> + <artifactId>sqlite-jdbc</artifactId> + <version>${sqlite-jdbc.version}</version> + </dependency> + <!-- https://mvnrepository.com/artifact/org.jdbi/jdbi3-core --> + <dependency> + <groupId>org.jdbi</groupId> + <artifactId>jdbi3-core</artifactId> + </dependency> + <dependency> + <groupId>org.jdbi</groupId> + <artifactId>jdbi3-sqlobject</artifactId> + </dependency> + <dependency> + <groupId>org.jdbi</groupId> + <artifactId>jdbi3-sqlite</artifactId> + </dependency> + <dependency> + <groupId>org.jdbi</groupId> + <artifactId>jdbi3-testing</artifactId> + <version>3.12.0</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>jakarta.xml.bind</groupId> + <artifactId>jakarta.xml.bind-api</artifactId> + <version>3.0.0</version> + </dependency> + <dependency> + <groupId>com.sun.xml.bind</groupId> + <artifactId>jaxb-impl</artifactId> + <version>3.0.0</version> + <scope>runtime</scope> + </dependency> + <!-- dependency> + <groupId></groupId> + <artifactId></artifactId> + <version></version> + </dependency--> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <version>3.8.1</version> + <inherited>true</inherited> + <configuration> + <release>11</release> + </configuration> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>exec-maven-plugin</artifactId> + <version>1.2.1</version> + <executions> + <execution> + <goals> + <goal>java</goal> + </goals> + </execution> + </executions> + <configuration> + <mainClass>fr.ulille.iut.pizzaland.Main</mainClass> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-shade-plugin</artifactId> + <version>${shade.version}</version> + <executions> + <execution> + <phase>package</phase> + <goals> + <goal>shade</goal> + </goals> + <configuration> + <transformers> + <transformer + implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> + <mainClass>fr.ulille.iut.pizzaland.Main</mainClass> + </transformer> + <transformer + implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" /> + </transformers> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> + + <properties> + <jersey.version>3.0.0</jersey.version> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <shade.version>3.2.4</shade.version> + <lombok.version>1.18.16</lombok.version> + <jdbi.version>3.16.0</jdbi.version> + <sqlite-jdbc.version>3.34.0</sqlite-jdbc.version> + <jaxb.version>2.4.0-b180830.0359</jaxb.version> + </properties> +</project> diff --git a/target/classes/fr/ulille/iut/pizzaland/ApiV1$1.class b/target/classes/fr/ulille/iut/pizzaland/ApiV1$1.class new file mode 100644 index 0000000000000000000000000000000000000000..24bf15125a480e7981e5439782d609cbf54858c4 Binary files /dev/null and b/target/classes/fr/ulille/iut/pizzaland/ApiV1$1.class differ diff --git a/target/classes/fr/ulille/iut/pizzaland/ApiV1.class b/target/classes/fr/ulille/iut/pizzaland/ApiV1.class new file mode 100644 index 0000000000000000000000000000000000000000..6f39718d330c615943b7193e602cbafa80b8f914 Binary files /dev/null and b/target/classes/fr/ulille/iut/pizzaland/ApiV1.class differ diff --git a/target/classes/fr/ulille/iut/pizzaland/BDDFactory.class b/target/classes/fr/ulille/iut/pizzaland/BDDFactory.class new file mode 100644 index 0000000000000000000000000000000000000000..cdcbd60121fbfbdf1502ffc86ff6d9f055c53ac3 Binary files /dev/null and b/target/classes/fr/ulille/iut/pizzaland/BDDFactory.class differ diff --git a/target/classes/fr/ulille/iut/pizzaland/Main.class b/target/classes/fr/ulille/iut/pizzaland/Main.class new file mode 100644 index 0000000000000000000000000000000000000000..2644378f8590d5a2ef9f74fa63104155282edc01 Binary files /dev/null and b/target/classes/fr/ulille/iut/pizzaland/Main.class differ diff --git a/target/classes/fr/ulille/iut/pizzaland/beans/.gitkeep b/target/classes/fr/ulille/iut/pizzaland/beans/.gitkeep new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/target/classes/fr/ulille/iut/pizzaland/beans/Commande.class b/target/classes/fr/ulille/iut/pizzaland/beans/Commande.class new file mode 100644 index 0000000000000000000000000000000000000000..66e626a051ea03a7e2f0fac720abab31e6b2de9a Binary files /dev/null and b/target/classes/fr/ulille/iut/pizzaland/beans/Commande.class differ diff --git a/target/classes/fr/ulille/iut/pizzaland/beans/Ingredient.class b/target/classes/fr/ulille/iut/pizzaland/beans/Ingredient.class new file mode 100644 index 0000000000000000000000000000000000000000..4df2414151b5fe27b80d647674923b6197b55126 Binary files /dev/null and b/target/classes/fr/ulille/iut/pizzaland/beans/Ingredient.class differ diff --git a/target/classes/fr/ulille/iut/pizzaland/beans/Pizza.class b/target/classes/fr/ulille/iut/pizzaland/beans/Pizza.class new file mode 100644 index 0000000000000000000000000000000000000000..6fa772e07d764c37940d366e4d8ca8a024a6b517 Binary files /dev/null and b/target/classes/fr/ulille/iut/pizzaland/beans/Pizza.class differ diff --git a/target/classes/fr/ulille/iut/pizzaland/dao/.gitkeep b/target/classes/fr/ulille/iut/pizzaland/dao/.gitkeep new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/target/classes/fr/ulille/iut/pizzaland/dao/CommandeDao.class b/target/classes/fr/ulille/iut/pizzaland/dao/CommandeDao.class new file mode 100644 index 0000000000000000000000000000000000000000..1747c3ce9ad01f15a075e7678356e34099f7a6f5 Binary files /dev/null and b/target/classes/fr/ulille/iut/pizzaland/dao/CommandeDao.class differ diff --git a/target/classes/fr/ulille/iut/pizzaland/dao/IngredientDao.class b/target/classes/fr/ulille/iut/pizzaland/dao/IngredientDao.class new file mode 100644 index 0000000000000000000000000000000000000000..e8d1e36b85adad7a03913a072ccda587c8eb7444 Binary files /dev/null and b/target/classes/fr/ulille/iut/pizzaland/dao/IngredientDao.class differ diff --git a/target/classes/fr/ulille/iut/pizzaland/dao/PizzaDao.class b/target/classes/fr/ulille/iut/pizzaland/dao/PizzaDao.class new file mode 100644 index 0000000000000000000000000000000000000000..889259dd50dd7c39c63779e5e51e7144fb5556ae Binary files /dev/null and b/target/classes/fr/ulille/iut/pizzaland/dao/PizzaDao.class differ diff --git a/target/classes/fr/ulille/iut/pizzaland/dao/UUIDArgument.class b/target/classes/fr/ulille/iut/pizzaland/dao/UUIDArgument.class new file mode 100644 index 0000000000000000000000000000000000000000..8ab0259d8479d2c392ee7866f83cefa28d1f494a Binary files /dev/null and b/target/classes/fr/ulille/iut/pizzaland/dao/UUIDArgument.class differ diff --git a/target/classes/fr/ulille/iut/pizzaland/dao/UUIDArgumentFactory.class b/target/classes/fr/ulille/iut/pizzaland/dao/UUIDArgumentFactory.class new file mode 100644 index 0000000000000000000000000000000000000000..8122dffbc0315bb1fdeec8164c1ccd3aa2cb7530 Binary files /dev/null and b/target/classes/fr/ulille/iut/pizzaland/dao/UUIDArgumentFactory.class differ diff --git a/target/classes/fr/ulille/iut/pizzaland/dto/CommandeCreateDto.class b/target/classes/fr/ulille/iut/pizzaland/dto/CommandeCreateDto.class new file mode 100644 index 0000000000000000000000000000000000000000..faeff370c78e9295738fa796f1ed33748b284bc3 Binary files /dev/null and b/target/classes/fr/ulille/iut/pizzaland/dto/CommandeCreateDto.class differ diff --git a/target/classes/fr/ulille/iut/pizzaland/dto/CommandeDto.class b/target/classes/fr/ulille/iut/pizzaland/dto/CommandeDto.class new file mode 100644 index 0000000000000000000000000000000000000000..5601622517bcc0665292903b01d4c3024a49098e Binary files /dev/null and b/target/classes/fr/ulille/iut/pizzaland/dto/CommandeDto.class differ diff --git a/target/classes/fr/ulille/iut/pizzaland/dto/IngredientCreateDto.class b/target/classes/fr/ulille/iut/pizzaland/dto/IngredientCreateDto.class new file mode 100644 index 0000000000000000000000000000000000000000..72f808355b3aea86906d0e983ebb7aee408358e3 Binary files /dev/null and b/target/classes/fr/ulille/iut/pizzaland/dto/IngredientCreateDto.class differ diff --git a/target/classes/fr/ulille/iut/pizzaland/dto/IngredientDto.class b/target/classes/fr/ulille/iut/pizzaland/dto/IngredientDto.class new file mode 100644 index 0000000000000000000000000000000000000000..423b863bc37924e99050c20ee9cd5c81f033a817 Binary files /dev/null and b/target/classes/fr/ulille/iut/pizzaland/dto/IngredientDto.class differ diff --git a/target/classes/fr/ulille/iut/pizzaland/dto/PizzaCreateDto.class b/target/classes/fr/ulille/iut/pizzaland/dto/PizzaCreateDto.class new file mode 100644 index 0000000000000000000000000000000000000000..df3ccff89cd1129f2b21094807d7a8567aec5efd Binary files /dev/null and b/target/classes/fr/ulille/iut/pizzaland/dto/PizzaCreateDto.class differ diff --git a/target/classes/fr/ulille/iut/pizzaland/dto/PizzaDto.class b/target/classes/fr/ulille/iut/pizzaland/dto/PizzaDto.class new file mode 100644 index 0000000000000000000000000000000000000000..8a48bb38b57cf09dbc79df03d03a130916da0091 Binary files /dev/null and b/target/classes/fr/ulille/iut/pizzaland/dto/PizzaDto.class differ diff --git a/target/classes/fr/ulille/iut/pizzaland/resources/BDDClearRessource.class b/target/classes/fr/ulille/iut/pizzaland/resources/BDDClearRessource.class new file mode 100644 index 0000000000000000000000000000000000000000..f614aa06861336d4e26735139598130a476c4d08 Binary files /dev/null and b/target/classes/fr/ulille/iut/pizzaland/resources/BDDClearRessource.class differ diff --git a/target/classes/fr/ulille/iut/pizzaland/resources/CommandeRessource.class b/target/classes/fr/ulille/iut/pizzaland/resources/CommandeRessource.class new file mode 100644 index 0000000000000000000000000000000000000000..78914e4cabb082bee560f10148e0442293f83d17 Binary files /dev/null and b/target/classes/fr/ulille/iut/pizzaland/resources/CommandeRessource.class differ diff --git a/target/classes/fr/ulille/iut/pizzaland/resources/IngredientResource.class b/target/classes/fr/ulille/iut/pizzaland/resources/IngredientResource.class new file mode 100644 index 0000000000000000000000000000000000000000..c382aaeafcaea73c236d9f73fda5b0d89dcaddda Binary files /dev/null and b/target/classes/fr/ulille/iut/pizzaland/resources/IngredientResource.class differ diff --git a/target/classes/fr/ulille/iut/pizzaland/resources/PizzaRessource.class b/target/classes/fr/ulille/iut/pizzaland/resources/PizzaRessource.class new file mode 100644 index 0000000000000000000000000000000000000000..f8882dd44e9e1078bdb61c5b9c48e3c6381c7f79 Binary files /dev/null and b/target/classes/fr/ulille/iut/pizzaland/resources/PizzaRessource.class differ diff --git a/target/classes/ingredients.json b/target/classes/ingredients.json new file mode 100644 index 0000000000000000000000000000000000000000..1dcc13bf14994920cf220d2bf4557181867be857 --- /dev/null +++ b/target/classes/ingredients.json @@ -0,0 +1,14 @@ +[ +{ "id": "f38806a8-7c85-49ef-980c-149dcd81d306", "name": "mozzarella"}, +{ "id": "d36903e1-0cc0-4bd6-a0ed-e0e9bf7b4037", "name": "jambon"}, +{ "id": "bc5b315f-442f-4ee4-96de-486d48f20c2f", "name": "champignons"}, +{ "id": "6a04320c-3a4f-4570-96d3-61faf3f898b0", "name": "olives"}, +{ "id": "c77deeee-d50d-49d5-9695-c98ec811f762", "name": "tomate"}, +{ "id": "c9375542-8142-43f6-b54d-0d63597cf614", "name": "merguez"}, +{ "id": "dee27dd6-f9b6-4d03-ac4b-216b5c9c8bd7", "name": "lardons"}, +{ "id": "657f8dd4-6bc1-4622-9af7-37d248846a23", "name": "fromage"}, +{ "id": "070d8077-a713-49a0-af37-3936b63d5ff2", "name": "oeuf"}, +{ "id": "5d9ca5c4-517f-40fd-aac3-5a823d680c1d", "name": "poivrons"}, +{ "id": "52f68024-24ec-46c0-8e77-c499dba1e27e", "name": "ananas"}, +{ "id": "dfdf6fae-f1b2-45fa-8c39-54e522c1933f", "name": "reblochon"} +] diff --git a/target/classes/logging.properties b/target/classes/logging.properties new file mode 100644 index 0000000000000000000000000000000000000000..db98114d366d9a6bfef0f729d08b24b09827227a --- /dev/null +++ b/target/classes/logging.properties @@ -0,0 +1,4 @@ +handlers= java.util.logging.ConsoleHandler +.level= INFO +java.util.logging.ConsoleHandler.level = INFO +java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter \ No newline at end of file diff --git a/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst new file mode 100644 index 0000000000000000000000000000000000000000..66d815d3ab8f2d3201f10dbf065044bebff77610 --- /dev/null +++ b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst @@ -0,0 +1,20 @@ +/home/infoetu/lepages/Prog_rep/m4102_tp3/src/main/java/fr/ulille/iut/pizzaland/resources/CommandeRessource.java +/home/infoetu/lepages/Prog_rep/m4102_tp3/src/main/java/fr/ulille/iut/pizzaland/resources/PizzaRessource.java +/home/infoetu/lepages/Prog_rep/m4102_tp3/src/main/java/fr/ulille/iut/pizzaland/resources/IngredientResource.java +/home/infoetu/lepages/Prog_rep/m4102_tp3/src/main/java/fr/ulille/iut/pizzaland/dao/UUIDArgument.java +/home/infoetu/lepages/Prog_rep/m4102_tp3/src/main/java/fr/ulille/iut/pizzaland/beans/Pizza.java +/home/infoetu/lepages/Prog_rep/m4102_tp3/src/main/java/fr/ulille/iut/pizzaland/dao/CommandeDao.java +/home/infoetu/lepages/Prog_rep/m4102_tp3/src/main/java/fr/ulille/iut/pizzaland/dao/IngredientDao.java +/home/infoetu/lepages/Prog_rep/m4102_tp3/src/main/java/fr/ulille/iut/pizzaland/resources/BDDClearRessource.java +/home/infoetu/lepages/Prog_rep/m4102_tp3/src/main/java/fr/ulille/iut/pizzaland/BDDFactory.java +/home/infoetu/lepages/Prog_rep/m4102_tp3/src/main/java/fr/ulille/iut/pizzaland/dto/PizzaCreateDto.java +/home/infoetu/lepages/Prog_rep/m4102_tp3/src/main/java/fr/ulille/iut/pizzaland/dto/CommandeDto.java +/home/infoetu/lepages/Prog_rep/m4102_tp3/src/main/java/fr/ulille/iut/pizzaland/dao/PizzaDao.java +/home/infoetu/lepages/Prog_rep/m4102_tp3/src/main/java/fr/ulille/iut/pizzaland/dao/UUIDArgumentFactory.java +/home/infoetu/lepages/Prog_rep/m4102_tp3/src/main/java/fr/ulille/iut/pizzaland/beans/Commande.java +/home/infoetu/lepages/Prog_rep/m4102_tp3/src/main/java/fr/ulille/iut/pizzaland/beans/Ingredient.java +/home/infoetu/lepages/Prog_rep/m4102_tp3/src/main/java/fr/ulille/iut/pizzaland/dto/PizzaDto.java +/home/infoetu/lepages/Prog_rep/m4102_tp3/src/main/java/fr/ulille/iut/pizzaland/ApiV1.java +/home/infoetu/lepages/Prog_rep/m4102_tp3/src/main/java/fr/ulille/iut/pizzaland/dto/IngredientCreateDto.java +/home/infoetu/lepages/Prog_rep/m4102_tp3/src/main/java/fr/ulille/iut/pizzaland/Main.java +/home/infoetu/lepages/Prog_rep/m4102_tp3/src/main/java/fr/ulille/iut/pizzaland/dto/IngredientDto.java diff --git a/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst b/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst b/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst new file mode 100644 index 0000000000000000000000000000000000000000..83c28364ba66fe55786973b5dee22aae6592abee --- /dev/null +++ b/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst @@ -0,0 +1,2 @@ +/home/infoetu/lepages/Prog_rep/m4102_tp3/src/test/java/fr/ulille/iut/pizzaland/IngredientResourceTest.java +/home/infoetu/lepages/Prog_rep/m4102_tp3/src/test/java/fr/ulille/iut/pizzaland/PizzaRessourceTest.java diff --git a/target/surefire-reports/TEST-fr.ulille.iut.pizzaland.CommandeRessourceTest.xml b/target/surefire-reports/TEST-fr.ulille.iut.pizzaland.CommandeRessourceTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..49d77b693f834810eb0462287e2da1d5ce8cdb9c --- /dev/null +++ b/target/surefire-reports/TEST-fr.ulille.iut.pizzaland.CommandeRessourceTest.xml @@ -0,0 +1,75 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<testsuite tests="11" failures="0" name="fr.ulille.iut.pizzaland.CommandeRessourceTest" time="2.79" errors="0" skipped="0"> + <properties> + <property name="java.runtime.name" value="OpenJDK Runtime Environment"/> + <property name="java.vm.version" value="11.0.9.1+1-post-Debian-1deb10u2"/> + <property name="sun.boot.library.path" value="/usr/lib/jvm/java-11-openjdk-amd64/lib"/> + <property name="user.country.format" value="FR"/> + <property name="maven.multiModuleProjectDirectory" value="/home/infoetu/lepages/Prog_rep/m4102_tp3"/> + <property name="java.vm.vendor" value="Debian"/> + <property name="java.vendor.url" value="https://tracker.debian.org/openjdk-11"/> + <property name="guice.disable.misplaced.annotation.check" value="true"/> + <property name="path.separator" value=":"/> + <property name="java.vm.name" value="OpenJDK 64-Bit Server VM"/> + <property name="sun.os.patch.level" value="unknown"/> + <property name="sun.java.launcher" value="SUN_STANDARD"/> + <property name="java.vm.specification.name" value="Java Virtual Machine Specification"/> + <property name="user.dir" value="/home/infoetu/lepages/Prog_rep/m4102_tp3"/> + <property name="java.vm.compressedOopsMode" value="Zero based"/> + <property name="java.runtime.version" value="11.0.9.1+1-post-Debian-1deb10u2"/> + <property name="java.awt.graphicsenv" value="sun.awt.X11GraphicsEnvironment"/> + <property name="os.arch" value="amd64"/> + <property name="java.io.tmpdir" value="/tmp"/> + <property name="line.separator" value=" +"/> + <property name="java.vm.specification.vendor" value="Oracle Corporation"/> + <property name="os.name" value="Linux"/> + <property name="classworlds.conf" value="/usr/share/maven/bin/m2.conf"/> + <property name="sun.jnu.encoding" value="UTF-8"/> + <property name="java.library.path" value="/usr/java/packages/lib:/usr/lib/x86_64-linux-gnu/jni:/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:/usr/lib/jni:/lib:/usr/lib"/> + <property name="maven.conf" value="/usr/share/maven/conf"/> + <property name="jdk.debug" value="release"/> + <property name="java.class.version" value="55.0"/> + <property name="java.specification.name" value="Java Platform API Specification"/> + <property name="sun.management.compiler" value="HotSpot 64-Bit Tiered Compilers"/> + <property name="os.version" value="4.19.0-14-amd64"/> + <property name="library.jansi.path" value="/usr/share/maven/lib/jansi-native"/> + <property name="user.home" value="/home/infoetu/lepages"/> + <property name="user.timezone" value="Europe/Paris"/> + <property name="java.awt.printerjob" value="sun.print.PSPrinterJob"/> + <property name="file.encoding" value="UTF-8"/> + <property name="java.specification.version" value="11"/> + <property name="user.name" value="lepages"/> + <property name="java.class.path" value="/usr/share/maven/boot/plexus-classworlds-2.x.jar"/> + <property name="java.vm.specification.version" value="11"/> + <property name="sun.arch.data.model" value="64"/> + <property name="sun.java.command" value="org.codehaus.plexus.classworlds.launcher.Launcher test"/> + <property name="java.home" value="/usr/lib/jvm/java-11-openjdk-amd64"/> + <property name="user.language" value="en"/> + <property name="java.specification.vendor" value="Oracle Corporation"/> + <property name="user.language.format" value="fr"/> + <property name="awt.toolkit" value="sun.awt.X11.XToolkit"/> + <property name="java.vm.info" value="mixed mode, sharing"/> + <property name="java.version" value="11.0.9.1"/> + <property name="securerandom.source" value="file:/dev/./urandom"/> + <property name="java.vendor" value="Debian"/> + <property name="maven.home" value="/usr/share/maven"/> + <property name="file.separator" value="/"/> + <property name="java.version.date" value="2020-11-04"/> + <property name="java.vendor.url.bug" value="https://bugs.debian.org/openjdk-11"/> + <property name="sun.io.unicode.encoding" value="UnicodeLittle"/> + <property name="sun.cpu.endian" value="little"/> + <property name="sun.cpu.isalist" value=""/> + </properties> + <testcase classname="fr.ulille.iut.pizzaland.CommandeRessourceTest" name="testDeleteNotExistingCommande" time="1.122"/> + <testcase classname="fr.ulille.iut.pizzaland.CommandeRessourceTest" name="testCreateCommande" time="0.247"/> + <testcase classname="fr.ulille.iut.pizzaland.CommandeRessourceTest" name="testGetEmptyList" time="0.154"/> + <testcase classname="fr.ulille.iut.pizzaland.CommandeRessourceTest" name="testDeleteExistingCommande" time="0.163"/> + <testcase classname="fr.ulille.iut.pizzaland.CommandeRessourceTest" name="testCreateCommandeWithoutName" time="0.16"/> + <testcase classname="fr.ulille.iut.pizzaland.CommandeRessourceTest" name="testGetExistingCommande" time="0.169"/> + <testcase classname="fr.ulille.iut.pizzaland.CommandeRessourceTest" name="testGetNotExistingCommande" time="0.2"/> + <testcase classname="fr.ulille.iut.pizzaland.CommandeRessourceTest" name="testGetExistingCommandeWithPizza" time="0.158"/> + <testcase classname="fr.ulille.iut.pizzaland.CommandeRessourceTest" name="testGetCommandeNomAndPrenom" time="0.182"/> + <testcase classname="fr.ulille.iut.pizzaland.CommandeRessourceTest" name="testCreateSameCommande" time="0.125"/> + <testcase classname="fr.ulille.iut.pizzaland.CommandeRessourceTest" name="testGetNotExistingCommandeNom" time="0.11"/> +</testsuite> \ No newline at end of file diff --git a/target/surefire-reports/TEST-fr.ulille.iut.pizzaland.IngredientResourceTest.xml b/target/surefire-reports/TEST-fr.ulille.iut.pizzaland.IngredientResourceTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..c7f0df37e2b40e03a835c0c40586aff74e1cf392 --- /dev/null +++ b/target/surefire-reports/TEST-fr.ulille.iut.pizzaland.IngredientResourceTest.xml @@ -0,0 +1,75 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<testsuite tests="11" failures="0" name="fr.ulille.iut.pizzaland.IngredientResourceTest" time="0.668" errors="0" skipped="0"> + <properties> + <property name="java.runtime.name" value="OpenJDK Runtime Environment"/> + <property name="java.vm.version" value="11.0.9.1+1-post-Debian-1deb10u2"/> + <property name="sun.boot.library.path" value="/usr/lib/jvm/java-11-openjdk-amd64/lib"/> + <property name="user.country.format" value="FR"/> + <property name="maven.multiModuleProjectDirectory" value="/home/infoetu/lepages/Prog_rep/m4102_tp3"/> + <property name="java.vm.vendor" value="Debian"/> + <property name="java.vendor.url" value="https://tracker.debian.org/openjdk-11"/> + <property name="guice.disable.misplaced.annotation.check" value="true"/> + <property name="path.separator" value=":"/> + <property name="java.vm.name" value="OpenJDK 64-Bit Server VM"/> + <property name="sun.os.patch.level" value="unknown"/> + <property name="sun.java.launcher" value="SUN_STANDARD"/> + <property name="java.vm.specification.name" value="Java Virtual Machine Specification"/> + <property name="user.dir" value="/home/infoetu/lepages/Prog_rep/m4102_tp3"/> + <property name="java.vm.compressedOopsMode" value="Zero based"/> + <property name="java.runtime.version" value="11.0.9.1+1-post-Debian-1deb10u2"/> + <property name="java.awt.graphicsenv" value="sun.awt.X11GraphicsEnvironment"/> + <property name="os.arch" value="amd64"/> + <property name="java.io.tmpdir" value="/tmp"/> + <property name="line.separator" value=" +"/> + <property name="java.vm.specification.vendor" value="Oracle Corporation"/> + <property name="os.name" value="Linux"/> + <property name="classworlds.conf" value="/usr/share/maven/bin/m2.conf"/> + <property name="sun.jnu.encoding" value="UTF-8"/> + <property name="java.library.path" value="/usr/java/packages/lib:/usr/lib/x86_64-linux-gnu/jni:/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:/usr/lib/jni:/lib:/usr/lib"/> + <property name="maven.conf" value="/usr/share/maven/conf"/> + <property name="jdk.debug" value="release"/> + <property name="java.class.version" value="55.0"/> + <property name="java.specification.name" value="Java Platform API Specification"/> + <property name="sun.management.compiler" value="HotSpot 64-Bit Tiered Compilers"/> + <property name="os.version" value="4.19.0-14-amd64"/> + <property name="library.jansi.path" value="/usr/share/maven/lib/jansi-native"/> + <property name="user.home" value="/home/infoetu/lepages"/> + <property name="user.timezone" value="Europe/Paris"/> + <property name="java.awt.printerjob" value="sun.print.PSPrinterJob"/> + <property name="file.encoding" value="UTF-8"/> + <property name="java.specification.version" value="11"/> + <property name="user.name" value="lepages"/> + <property name="java.class.path" value="/usr/share/maven/boot/plexus-classworlds-2.x.jar"/> + <property name="java.vm.specification.version" value="11"/> + <property name="sun.arch.data.model" value="64"/> + <property name="sun.java.command" value="org.codehaus.plexus.classworlds.launcher.Launcher test"/> + <property name="java.home" value="/usr/lib/jvm/java-11-openjdk-amd64"/> + <property name="user.language" value="en"/> + <property name="java.specification.vendor" value="Oracle Corporation"/> + <property name="user.language.format" value="fr"/> + <property name="awt.toolkit" value="sun.awt.X11.XToolkit"/> + <property name="java.vm.info" value="mixed mode, sharing"/> + <property name="java.version" value="11.0.9.1"/> + <property name="securerandom.source" value="file:/dev/./urandom"/> + <property name="java.vendor" value="Debian"/> + <property name="maven.home" value="/usr/share/maven"/> + <property name="file.separator" value="/"/> + <property name="java.version.date" value="2020-11-04"/> + <property name="java.vendor.url.bug" value="https://bugs.debian.org/openjdk-11"/> + <property name="sun.io.unicode.encoding" value="UnicodeLittle"/> + <property name="sun.cpu.endian" value="little"/> + <property name="sun.cpu.isalist" value=""/> + </properties> + <testcase classname="fr.ulille.iut.pizzaland.IngredientResourceTest" name="testGetNotExistingIngredient" time="0.061"/> + <testcase classname="fr.ulille.iut.pizzaland.IngredientResourceTest" name="testCreateSameIngredient" time="0.065"/> + <testcase classname="fr.ulille.iut.pizzaland.IngredientResourceTest" name="testCreateWithForm" time="0.083"/> + <testcase classname="fr.ulille.iut.pizzaland.IngredientResourceTest" name="testCreateIngredientWithoutName" time="0.067"/> + <testcase classname="fr.ulille.iut.pizzaland.IngredientResourceTest" name="testGetEmptyList" time="0.059"/> + <testcase classname="fr.ulille.iut.pizzaland.IngredientResourceTest" name="testDeleteExistingIngredient" time="0.061"/> + <testcase classname="fr.ulille.iut.pizzaland.IngredientResourceTest" name="testGetNotExistingIngredientName" time="0.048"/> + <testcase classname="fr.ulille.iut.pizzaland.IngredientResourceTest" name="testCreateIngredient" time="0.059"/> + <testcase classname="fr.ulille.iut.pizzaland.IngredientResourceTest" name="testGetExistingIngredient" time="0.058"/> + <testcase classname="fr.ulille.iut.pizzaland.IngredientResourceTest" name="testDeleteNotExistingIngredient" time="0.05"/> + <testcase classname="fr.ulille.iut.pizzaland.IngredientResourceTest" name="testGetIngredientName" time="0.057"/> +</testsuite> \ No newline at end of file diff --git a/target/surefire-reports/TEST-fr.ulille.iut.pizzaland.PizzaRessourceTest.xml b/target/surefire-reports/TEST-fr.ulille.iut.pizzaland.PizzaRessourceTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..53be68fbaf2eb1fece3bef4141f31da1678ee4d0 --- /dev/null +++ b/target/surefire-reports/TEST-fr.ulille.iut.pizzaland.PizzaRessourceTest.xml @@ -0,0 +1,75 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<testsuite tests="11" failures="0" name="fr.ulille.iut.pizzaland.PizzaRessourceTest" time="1.055" errors="0" skipped="0"> + <properties> + <property name="java.runtime.name" value="OpenJDK Runtime Environment"/> + <property name="java.vm.version" value="11.0.9.1+1-post-Debian-1deb10u2"/> + <property name="sun.boot.library.path" value="/usr/lib/jvm/java-11-openjdk-amd64/lib"/> + <property name="user.country.format" value="FR"/> + <property name="maven.multiModuleProjectDirectory" value="/home/infoetu/lepages/Prog_rep/m4102_tp3"/> + <property name="java.vm.vendor" value="Debian"/> + <property name="java.vendor.url" value="https://tracker.debian.org/openjdk-11"/> + <property name="guice.disable.misplaced.annotation.check" value="true"/> + <property name="path.separator" value=":"/> + <property name="java.vm.name" value="OpenJDK 64-Bit Server VM"/> + <property name="sun.os.patch.level" value="unknown"/> + <property name="sun.java.launcher" value="SUN_STANDARD"/> + <property name="java.vm.specification.name" value="Java Virtual Machine Specification"/> + <property name="user.dir" value="/home/infoetu/lepages/Prog_rep/m4102_tp3"/> + <property name="java.vm.compressedOopsMode" value="Zero based"/> + <property name="java.runtime.version" value="11.0.9.1+1-post-Debian-1deb10u2"/> + <property name="java.awt.graphicsenv" value="sun.awt.X11GraphicsEnvironment"/> + <property name="os.arch" value="amd64"/> + <property name="java.io.tmpdir" value="/tmp"/> + <property name="line.separator" value=" +"/> + <property name="java.vm.specification.vendor" value="Oracle Corporation"/> + <property name="os.name" value="Linux"/> + <property name="classworlds.conf" value="/usr/share/maven/bin/m2.conf"/> + <property name="sun.jnu.encoding" value="UTF-8"/> + <property name="java.library.path" value="/usr/java/packages/lib:/usr/lib/x86_64-linux-gnu/jni:/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:/usr/lib/jni:/lib:/usr/lib"/> + <property name="maven.conf" value="/usr/share/maven/conf"/> + <property name="jdk.debug" value="release"/> + <property name="java.class.version" value="55.0"/> + <property name="java.specification.name" value="Java Platform API Specification"/> + <property name="sun.management.compiler" value="HotSpot 64-Bit Tiered Compilers"/> + <property name="os.version" value="4.19.0-14-amd64"/> + <property name="library.jansi.path" value="/usr/share/maven/lib/jansi-native"/> + <property name="user.home" value="/home/infoetu/lepages"/> + <property name="user.timezone" value="Europe/Paris"/> + <property name="java.awt.printerjob" value="sun.print.PSPrinterJob"/> + <property name="file.encoding" value="UTF-8"/> + <property name="java.specification.version" value="11"/> + <property name="user.name" value="lepages"/> + <property name="java.class.path" value="/usr/share/maven/boot/plexus-classworlds-2.x.jar"/> + <property name="java.vm.specification.version" value="11"/> + <property name="sun.arch.data.model" value="64"/> + <property name="sun.java.command" value="org.codehaus.plexus.classworlds.launcher.Launcher test"/> + <property name="java.home" value="/usr/lib/jvm/java-11-openjdk-amd64"/> + <property name="user.language" value="en"/> + <property name="java.specification.vendor" value="Oracle Corporation"/> + <property name="user.language.format" value="fr"/> + <property name="awt.toolkit" value="sun.awt.X11.XToolkit"/> + <property name="java.vm.info" value="mixed mode, sharing"/> + <property name="java.version" value="11.0.9.1"/> + <property name="securerandom.source" value="file:/dev/./urandom"/> + <property name="java.vendor" value="Debian"/> + <property name="maven.home" value="/usr/share/maven"/> + <property name="file.separator" value="/"/> + <property name="java.version.date" value="2020-11-04"/> + <property name="java.vendor.url.bug" value="https://bugs.debian.org/openjdk-11"/> + <property name="sun.io.unicode.encoding" value="UnicodeLittle"/> + <property name="sun.cpu.endian" value="little"/> + <property name="sun.cpu.isalist" value=""/> + </properties> + <testcase classname="fr.ulille.iut.pizzaland.PizzaRessourceTest" name="testGetEmptyListPizza" time="0.137"/> + <testcase classname="fr.ulille.iut.pizzaland.PizzaRessourceTest" name="testCreatePizza" time="0.099"/> + <testcase classname="fr.ulille.iut.pizzaland.PizzaRessourceTest" name="testGetNotExistingPizzaName" time="0.079"/> + <testcase classname="fr.ulille.iut.pizzaland.PizzaRessourceTest" name="testGetPizzaName" time="0.103"/> + <testcase classname="fr.ulille.iut.pizzaland.PizzaRessourceTest" name="testGetExistingPizzaWithIngredients" time="0.111"/> + <testcase classname="fr.ulille.iut.pizzaland.PizzaRessourceTest" name="testCreateSamePizza" time="0.095"/> + <testcase classname="fr.ulille.iut.pizzaland.PizzaRessourceTest" name="testDeleteNotExistingPizza" time="0.084"/> + <testcase classname="fr.ulille.iut.pizzaland.PizzaRessourceTest" name="testGetExistingPizza" time="0.099"/> + <testcase classname="fr.ulille.iut.pizzaland.PizzaRessourceTest" name="testDeleteExistingPizza" time="0.087"/> + <testcase classname="fr.ulille.iut.pizzaland.PizzaRessourceTest" name="testCreatePizzaWithoutName" time="0.079"/> + <testcase classname="fr.ulille.iut.pizzaland.PizzaRessourceTest" name="testGetNotExistingPizza" time="0.082"/> +</testsuite> \ No newline at end of file diff --git a/target/surefire-reports/fr.ulille.iut.pizzaland.CommandeRessourceTest.txt b/target/surefire-reports/fr.ulille.iut.pizzaland.CommandeRessourceTest.txt new file mode 100644 index 0000000000000000000000000000000000000000..d81ee11a36ef70d73e22faa89a387aeaab66411f --- /dev/null +++ b/target/surefire-reports/fr.ulille.iut.pizzaland.CommandeRessourceTest.txt @@ -0,0 +1,4 @@ +------------------------------------------------------------------------------- +Test set: fr.ulille.iut.pizzaland.CommandeRessourceTest +------------------------------------------------------------------------------- +Tests run: 11, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.869 sec diff --git a/target/surefire-reports/fr.ulille.iut.pizzaland.IngredientResourceTest.txt b/target/surefire-reports/fr.ulille.iut.pizzaland.IngredientResourceTest.txt new file mode 100644 index 0000000000000000000000000000000000000000..918201654ed929df3b8de75b3cba0f78bfd459c3 --- /dev/null +++ b/target/surefire-reports/fr.ulille.iut.pizzaland.IngredientResourceTest.txt @@ -0,0 +1,4 @@ +------------------------------------------------------------------------------- +Test set: fr.ulille.iut.pizzaland.IngredientResourceTest +------------------------------------------------------------------------------- +Tests run: 11, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.677 sec diff --git a/target/surefire-reports/fr.ulille.iut.pizzaland.PizzaRessourceTest.txt b/target/surefire-reports/fr.ulille.iut.pizzaland.PizzaRessourceTest.txt new file mode 100644 index 0000000000000000000000000000000000000000..631b550eaaec6026b2a41ef33e0a4ad3dc23e8a2 --- /dev/null +++ b/target/surefire-reports/fr.ulille.iut.pizzaland.PizzaRessourceTest.txt @@ -0,0 +1,4 @@ +------------------------------------------------------------------------------- +Test set: fr.ulille.iut.pizzaland.PizzaRessourceTest +------------------------------------------------------------------------------- +Tests run: 11, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.063 sec diff --git a/target/test-classes/fr/ulille/iut/pizzaland/CommandeRessourceTest$1.class b/target/test-classes/fr/ulille/iut/pizzaland/CommandeRessourceTest$1.class new file mode 100644 index 0000000000000000000000000000000000000000..78157a5e878c0a350e725f83af1184f248d528ae Binary files /dev/null and b/target/test-classes/fr/ulille/iut/pizzaland/CommandeRessourceTest$1.class differ diff --git a/target/test-classes/fr/ulille/iut/pizzaland/CommandeRessourceTest.class b/target/test-classes/fr/ulille/iut/pizzaland/CommandeRessourceTest.class new file mode 100644 index 0000000000000000000000000000000000000000..469ac61461efa4359e697fa8309fbc44777e510e Binary files /dev/null and b/target/test-classes/fr/ulille/iut/pizzaland/CommandeRessourceTest.class differ diff --git a/target/test-classes/fr/ulille/iut/pizzaland/IngredientResourceTest$1.class b/target/test-classes/fr/ulille/iut/pizzaland/IngredientResourceTest$1.class new file mode 100644 index 0000000000000000000000000000000000000000..9ddeff5fa817b7e7e5ed2913cf146e4066cd2eb8 Binary files /dev/null and b/target/test-classes/fr/ulille/iut/pizzaland/IngredientResourceTest$1.class differ diff --git a/target/test-classes/fr/ulille/iut/pizzaland/IngredientResourceTest.class b/target/test-classes/fr/ulille/iut/pizzaland/IngredientResourceTest.class new file mode 100644 index 0000000000000000000000000000000000000000..a0439577ba0cac3f20f4a9f45c5a1bd3cd842c5b Binary files /dev/null and b/target/test-classes/fr/ulille/iut/pizzaland/IngredientResourceTest.class differ diff --git a/target/test-classes/fr/ulille/iut/pizzaland/PizzaRessourceTest$1.class b/target/test-classes/fr/ulille/iut/pizzaland/PizzaRessourceTest$1.class new file mode 100644 index 0000000000000000000000000000000000000000..fe0cf3663f70123a18f5b1dbec5430e76edef6b8 Binary files /dev/null and b/target/test-classes/fr/ulille/iut/pizzaland/PizzaRessourceTest$1.class differ diff --git a/target/test-classes/fr/ulille/iut/pizzaland/PizzaRessourceTest.class b/target/test-classes/fr/ulille/iut/pizzaland/PizzaRessourceTest.class new file mode 100644 index 0000000000000000000000000000000000000000..9ac6d6f83e83a3b75755abc5857a82c40e677b50 Binary files /dev/null and b/target/test-classes/fr/ulille/iut/pizzaland/PizzaRessourceTest.class differ diff --git a/target/test-classes/logging.properties b/target/test-classes/logging.properties new file mode 100644 index 0000000000000000000000000000000000000000..db98114d366d9a6bfef0f729d08b24b09827227a --- /dev/null +++ b/target/test-classes/logging.properties @@ -0,0 +1,4 @@ +handlers= java.util.logging.ConsoleHandler +.level= INFO +java.util.logging.ConsoleHandler.level = INFO +java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter \ No newline at end of file