Correct get users 🐛
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
a921345f49
commit
a336610308
@ -1,32 +0,0 @@
|
|||||||
package org.acme.Api.controllers;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import javax.enterprise.context.ApplicationScoped;
|
|
||||||
import javax.inject.Inject;
|
|
||||||
import javax.ws.rs.Consumes;
|
|
||||||
import javax.ws.rs.DELETE;
|
|
||||||
import javax.ws.rs.GET;
|
|
||||||
import javax.ws.rs.POST;
|
|
||||||
import javax.ws.rs.PUT;
|
|
||||||
import javax.ws.rs.Path;
|
|
||||||
import javax.ws.rs.PathParam;
|
|
||||||
import javax.ws.rs.Produces;
|
|
||||||
import javax.ws.rs.core.MediaType;
|
|
||||||
import javax.ws.rs.core.Response;
|
|
||||||
import javax.ws.rs.core.Response.Status;
|
|
||||||
|
|
||||||
import io.smallrye.mutiny.Uni;
|
|
||||||
|
|
||||||
@ApplicationScoped
|
|
||||||
@Path("/test")
|
|
||||||
public class TestController {
|
|
||||||
|
|
||||||
@GET
|
|
||||||
@Produces(MediaType.TEXT_PLAIN)
|
|
||||||
@Path("/po")
|
|
||||||
public String hello() {
|
|
||||||
return "Hello from RESTEasy Reactive";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,5 +0,0 @@
|
|||||||
package org.acme.Api.service;
|
|
||||||
|
|
||||||
public class UserService {
|
|
||||||
|
|
||||||
}
|
|
@ -1,61 +1,12 @@
|
|||||||
-- INSERT INTO users(id, name,password) VALUES (nextval('hibernate_sequence'), 'Emre','Emre');
|
INSERT INTO
|
||||||
-- INSERT INTO users(id, name,password) VALUES (nextval('hibernate_sequence'), 'Arthur','Arthur');
|
Users (name, password, image, mail)
|
||||||
-- INSERT INTO users(id, name,password) VALUES (nextval('hibernate_sequence'), 'Lucas','Lucas');
|
VALUES
|
||||||
-- INSERT INTO users(id, name,password) VALUES (nextval('hibernate_sequence'), 'Louison','Louison');
|
('David', 'password123','','david.d_almeida@etu.uca.fr'),
|
||||||
-- INSERT INTO users (Id, Name, Password) VALUES (1, 'Alice', 'password1'),
|
('Emre', 'password2','','emre.kartal@etu.uca.fr'),
|
||||||
-- (2, 'Bob', 'password2'),
|
('Arthur', 'password3','','arthur.valin@etu.uca.fr');
|
||||||
-- (3, 'Charlie', 'password3');
|
|
||||||
-- INSERT INTO user_stats (user_id, nbVictories, nbGames) VALUES
|
/*INSERT INTO games (isFinished, nbPoints, time, winner, host_id) VALUES (false, 0, CURRENT_TIMESTAMP, 0, 1);
|
||||||
-- (1, 2, 5),
|
|
||||||
-- (2, 3, 7),
|
|
||||||
-- (3, 1, 3);
|
|
||||||
-- INSERT INTO games (Id, host_id) VALUES
|
|
||||||
-- (1, 1),
|
|
||||||
-- (2, 2);
|
|
||||||
-- INSERT INTO participe (idGame, position, iduser, guestname, totalPoints) VALUES
|
|
||||||
-- (1, 1, 1, NULL, 0),
|
|
||||||
-- (1, 2, 2, NULL, 0),
|
|
||||||
-- (2, 1, 2, NULL, 0),
|
|
||||||
-- (2, 2, NULL, 'guest1', 0),
|
|
||||||
-- (2, 3, NULL, 'guest2', 0);
|
|
||||||
-- INSERT INTO round (game_id, PlayerPosition, TurnNumber, points) VALUES
|
|
||||||
-- (1, 1, 1, 10),
|
|
||||||
-- (1, 2, 1, 7),
|
|
||||||
-- (1, 1, 2, 9),
|
|
||||||
-- (1, 2, 2, 1),
|
|
||||||
-- (1, 1, 3, 3),
|
|
||||||
-- (1, 2, 3, 10),
|
|
||||||
-- (2, 1, 1, 9),
|
|
||||||
-- (2, 2, 1, 1),
|
|
||||||
-- (2, 1, 2, 8),
|
|
||||||
-- (2, 2, 2, 2),
|
|
||||||
-- (2, 3, 2, 0),
|
|
||||||
-- (2, 1, 3, 10),
|
|
||||||
-- (2, 2, 3, 10),
|
|
||||||
-- (2, 3, 3, 7);
|
|
||||||
|
|
||||||
-- INSERT INTO ThrowTable (Order, idGame, position, , pins) VALUES
|
|
||||||
-- (1, 1, 1, 10),
|
|
||||||
-- (1, 1, 2, 7),
|
|
||||||
-- (2, 1, 1, 9),
|
|
||||||
-- (2, 1, 2, 1),
|
|
||||||
-- (3, 1, 1, 3),
|
|
||||||
-- (3, 1, 2, 10),
|
|
||||||
-- (1, 2, 1, 9),
|
|
||||||
-- (1, 2, 2, 1),
|
|
||||||
-- (2, 2, 1, 8),
|
|
||||||
-- (2, 2, 2, 2),
|
|
||||||
-- (3, 2, 3, 0),
|
|
||||||
-- (3, 2, 1, 10),
|
|
||||||
-- (4, 2, 2, 10),
|
|
||||||
-- (4, 2, 3, 7);
|
|
||||||
|
|
||||||
INSERT INTO users (name, password) VALUES ('Alice', 'password123');
|
|
||||||
INSERT INTO users (name, Password) VALUES
|
|
||||||
('Bob', 'password2'),
|
|
||||||
('Charlie', 'password3');
|
|
||||||
INSERT INTO games (isFinished, nbPoints, time, winner, host_id) VALUES (false, 0, CURRENT_TIMESTAMP, 0, 1);
|
|
||||||
INSERT INTO participe (idGame, position, guestname, totalpoints, iduser) VALUES (1, 1, 'Alice', 0, 1);
|
INSERT INTO participe (idGame, position, guestname, totalpoints, iduser) VALUES (1, 1, 'Alice', 0, 1);
|
||||||
INSERT INTO round (game_id, idGame, position, turnNumber, points) VALUES (1, 1, 1, 1, 0);
|
INSERT INTO round (game_id, idGame, position, turnNumber, points) VALUES (1, 1, 1, 1, 0);
|
||||||
INSERT INTO throwtable (OrderTrhow, game_id, idGame, position, turnNumber, pins) VALUES (1, 1, 1, 1, 1, 0);
|
INSERT INTO throwtable (OrderTrhow, game_id, idGame, position, turnNumber, pins) VALUES (1, 1, 1, 1, 1, 0);
|
||||||
INSERT INTO user_stats (user_id, avgPinsPerRound, avgScore, highscore, nbGames, nbSpares, nbStrikes, nbVictories) VALUES (1, 0, 0, 0, 0, 0, 0, 0);
|
INSERT INTO user_stats (user_id, avgPinsPerRound, avgScore, highscore, nbGames, nbSpares, nbStrikes, nbVictories) VALUES (1, 0, 0, 0, 0, 0, 0, 0);*/
|
||||||
|
@ -1,56 +0,0 @@
|
|||||||
// package org.acme;
|
|
||||||
|
|
||||||
// import java.util.List;
|
|
||||||
|
|
||||||
// import org.acme.Api.controllers.UserController;
|
|
||||||
// import org.acme.Api.service.UserService;
|
|
||||||
// import org.acme.Hibernates.entities.UserEntity;
|
|
||||||
|
|
||||||
// @ExtendWith(MockitoExtension.class)
|
|
||||||
// public class UserCtrlTest {
|
|
||||||
// @Mock
|
|
||||||
// private UserService userService;
|
|
||||||
|
|
||||||
// @InjectMocks
|
|
||||||
// private UserController userController;
|
|
||||||
|
|
||||||
// @TestFactory
|
|
||||||
// Stream<DynamicTest> shouldReturnUserById() {
|
|
||||||
// List<UserEntity> users = Arrays.asList(
|
|
||||||
// new UserEntity(1L, "John", "password"),
|
|
||||||
// new UserEntity(2L, "Jane", "password"));
|
|
||||||
|
|
||||||
// return DynamicTest.stream(
|
|
||||||
// users.iterator(),
|
|
||||||
// user -> "should return user with id " + user.getId(),
|
|
||||||
// user -> {
|
|
||||||
// // Given
|
|
||||||
// Mockito.when(userService.findByBowlinId(user.getId()))
|
|
||||||
// .thenReturn(CompletableFuture.completedFuture(user));
|
|
||||||
|
|
||||||
// // When
|
|
||||||
// Uni<Response> response = userController.getUserById(user.getId());
|
|
||||||
|
|
||||||
// // Then
|
|
||||||
// response.subscribe().with(result -> {
|
|
||||||
// assertEquals(Response.Status.OK.getStatusCode(), result.getStatus());
|
|
||||||
// assertEquals(user, result.getEntity());
|
|
||||||
// });
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
|
|
||||||
// @Test
|
|
||||||
// void shouldReturn404IfUserNotFound() {
|
|
||||||
// // Given
|
|
||||||
// Long id = 1L;
|
|
||||||
// Mockito.when(userService.findByBowlinId(id)).thenReturn(CompletableFuture.completedFuture(null));
|
|
||||||
|
|
||||||
// // When
|
|
||||||
// Uni<Response> response = userController.getUserById(id);
|
|
||||||
|
|
||||||
// // Then
|
|
||||||
// response.subscribe().with(result -> {
|
|
||||||
// assertEquals(Response.Status.NOT_FOUND.getStatusCode(), result.getStatus());
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
// }
|
|
Loading…
Reference in new issue