Skip to content
Snippets Groups Projects
Commit b2e74b99 authored by Alban Sannier's avatar Alban Sannier
Browse files

Récupérer la description d'une tâche FINI

parent c42d2483
Branches master
No related tags found
No related merge requests found
Pipeline #8331 failed
...@@ -3,6 +3,7 @@ package fr.ulille.iut.todo.dao; ...@@ -3,6 +3,7 @@ package fr.ulille.iut.todo.dao;
import java.util.List; import java.util.List;
import org.jdbi.v3.sqlobject.config.RegisterBeanMapper; import org.jdbi.v3.sqlobject.config.RegisterBeanMapper;
import org.jdbi.v3.sqlobject.customizer.BindBean; import org.jdbi.v3.sqlobject.customizer.BindBean;
import org.jdbi.v3.sqlobject.customizer.BindMap;
import org.jdbi.v3.sqlobject.statement.SqlQuery; import org.jdbi.v3.sqlobject.statement.SqlQuery;
import org.jdbi.v3.sqlobject.statement.SqlUpdate; import org.jdbi.v3.sqlobject.statement.SqlUpdate;
...@@ -24,5 +25,9 @@ public interface TacheDAO { ...@@ -24,5 +25,9 @@ public interface TacheDAO {
@SqlQuery("select * from taches") @SqlQuery("select * from taches")
@RegisterBeanMapper(Tache.class) @RegisterBeanMapper(Tache.class)
List<Tache> getAll(); List<Tache> getAll();
@SqlQuery("select * from taches where id = ?")
@RegisterBeanMapper(Tache.class)
Tache getById(String pId);
} }
...@@ -38,6 +38,14 @@ public class TodoRessource { ...@@ -38,6 +38,14 @@ public class TodoRessource {
@Context @Context
Request request; Request request;
@GET
@Path("{id}")
public Tache getById(@PathParam("id") String id) {
LOGGER.info("getById()");
return todoService.getTache(UUID.fromString(id));
}
@GET @GET
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public List<Tache> getAll() { public List<Tache> getAll() {
......
...@@ -15,7 +15,7 @@ public class TodoService { ...@@ -15,7 +15,7 @@ public class TodoService {
} }
public Tache getTache(UUID id) { public Tache getTache(UUID id) {
return null; return taches.getById(id.toString());
} }
public List<Tache> getAll() { public List<Tache> getAll() {
......
...@@ -5,6 +5,7 @@ import static org.junit.Assert.assertTrue; ...@@ -5,6 +5,7 @@ import static org.junit.Assert.assertTrue;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.UUID;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
...@@ -96,6 +97,10 @@ public class TodoRessourceTest extends JerseyTest { ...@@ -96,6 +97,10 @@ public class TodoRessourceTest extends JerseyTest {
@Test @Test
public void get_with_wrong_id_should_return_404() { public void get_with_wrong_id_should_return_404() {
Response res = target("taches").path("tyuio").request().get();
System.out.println("res.getSttus = "+res.getStatus() + "");
assertEquals("404", res.getStatus() + "");
} }
@Test @Test
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment