Commit 62ed607d081b9f76873450abcf7eb9c3734a1c8e

Authored by jcartign
1 parent 701b45d1

Porting update from spring-persistence-jdbc

src/main/java/fr/plil/sio/persistence/api/GroupService.java
@@ -4,12 +4,12 @@ public interface GroupService { @@ -4,12 +4,12 @@ public interface GroupService {
4 4
5 /** 5 /**
6 * Create a group with a specific name in the database. 6 * Create a group with a specific name in the database.
7 - * There is no two groups with the same name in the database. 7 + * There is no two groups with the same name or the same ID in the database.
8 * 8 *
9 * @param name the name of the group 9 * @param name the name of the group
10 * @return an instance of the group 10 * @return an instance of the group
11 * @throws IllegalArgumentException if name is null 11 * @throws IllegalArgumentException if name is null
12 - * @throws IllegalStateException if a group with the same name is already present 12 + * @throws IllegalStateException if a group with the same name is already present
13 */ 13 */
14 Group create(String name); 14 Group create(String name);
15 15
@@ -32,7 +32,7 @@ public interface GroupService { @@ -32,7 +32,7 @@ public interface GroupService {
32 Group findByName(String name); 32 Group findByName(String name);
33 33
34 /** 34 /**
35 - * Add a right in the group. Right is inserted at the end of rights list of the group. 35 + * Add a right in the group.
36 * 36 *
37 * @param groupName the name of the group. 37 * @param groupName the name of the group.
38 * @param right the right to add 38 * @param right the right to add
src/main/java/fr/plil/sio/persistence/api/UserService.java
@@ -6,7 +6,7 @@ public interface UserService { @@ -6,7 +6,7 @@ public interface UserService {
6 * Create an user with a specific name in the database and affected to an existing group. 6 * Create an user with a specific name in the database and affected to an existing group.
7 * There is no two users with the same name in the database. 7 * There is no two users with the same name in the database.
8 * 8 *
9 - * @param name the name of the user 9 + * @param name the name of the user
10 * @param groupName the name of the group 10 * @param groupName the name of the group
11 * @return an instance of the user 11 * @return an instance of the user
12 * @throws IllegalArgumentException if name or groupName is null, or if group does not exist. 12 * @throws IllegalArgumentException if name or groupName is null, or if group does not exist.
src/test/java/fr/plil/sio/persistence/jpa/RightServiceTest.java
@@ -90,7 +90,7 @@ public class RightServiceTest { @@ -90,7 +90,7 @@ public class RightServiceTest {
90 public void testDeleteRightIfNotInDatabase() { 90 public void testDeleteRightIfNotInDatabase() {
91 Right right = new Right(); 91 Right right = new Right();
92 right.setName("not-a-right"); 92 right.setName("not-a-right");
93 - assertFalse(rightService.delete(right)); 93 + rightService.delete(right);
94 } 94 }
95 95
96 @Test(expected = IllegalArgumentException.class) 96 @Test(expected = IllegalArgumentException.class)
src/test/java/fr/plil/sio/persistence/jpa/UserServiceTest.java
@@ -70,6 +70,7 @@ public class UserServiceTest { @@ -70,6 +70,7 @@ public class UserServiceTest {
70 70
71 @Test 71 @Test
72 public void testDeleteUserIfNotFound() { 72 public void testDeleteUserIfNotFound() {
  73 + userService.delete("user");
73 assertFalse(userService.delete("user")); 74 assertFalse(userService.delete("user"));
74 } 75 }
75 76
src/test/resources/application.properties
@@ -2,4 +2,4 @@ logging.level.org.springframework=INFO @@ -2,4 +2,4 @@ logging.level.org.springframework=INFO
2 logging.level.org.hibernate.SQL=DEBUG 2 logging.level.org.hibernate.SQL=DEBUG
3 logging.level.org.hibernate=INFO 3 logging.level.org.hibernate=INFO
4 spring.datasource.url=jdbc:h2:mem:persistence;TRACE_LEVEL_FILE=4; 4 spring.datasource.url=jdbc:h2:mem:persistence;TRACE_LEVEL_FILE=4;
5 -spring.datasource.tomcat.max-active=300  
6 \ No newline at end of file 5 \ No newline at end of file
  6 +spring.datasource.tomcat.max-active=500
7 \ No newline at end of file 7 \ No newline at end of file