Commit 57fb694e60241d39d30cca55eba31c87f9e909cd
Merge branch 'master' of archives.plil.fr:GIS2A4-Java/spring-persistence
Conflicts: src/test/java/fr/plil/sio/persistence/jdbc/GroupServiceTest.java src/test/resources/application.properties
Showing
5 changed files
with
30 additions
and
5 deletions
Show diff stats
@@ -0,0 +1,23 @@ | @@ -0,0 +1,23 @@ | ||
1 | +Description | ||
2 | +=========== | ||
3 | + | ||
4 | + | ||
5 | + | ||
6 | + | ||
7 | +TODO | ||
8 | +==== | ||
9 | + | ||
10 | +Documentation | ||
11 | +------------- | ||
12 | + | ||
13 | +* add usage scenario | ||
14 | +* complete documentation to precise one level dependencies for create and find methods | ||
15 | +* clarify tree of rights | ||
16 | +* clarify why the dependencies need to be managed in the service (to avoid to break the | ||
17 | +CRUD model, *i.e.* reppsitory methods are specialised to load the one-level | ||
18 | +dependencies, thus cannot be used to load object as dependencies | ||
19 | + | ||
20 | +Tests | ||
21 | +----- | ||
22 | + | ||
23 | +* tests for one-level dependencies | ||
0 | \ No newline at end of file | 24 | \ No newline at end of file |
src/test/java/fr/plil/sio/persistence/jdbc/GroupServiceTest.java
@@ -147,8 +147,8 @@ public class GroupServiceTest extends AbstractServiceSupport { | @@ -147,8 +147,8 @@ public class GroupServiceTest extends AbstractServiceSupport { | ||
147 | assertEquals(0, group.getRights().size()); | 147 | assertEquals(0, group.getRights().size()); |
148 | } | 148 | } |
149 | 149 | ||
150 | - @Test | ||
151 | - public void testRemoveRightIfNotPresent() { | 150 | + @Test(expected = IllegalArgumentException.class) |
151 | + public void testRemoveRightIfNotInDatabase() { | ||
152 | logger.info("testRemoveRightIfNotPresent"); | 152 | logger.info("testRemoveRightIfNotPresent"); |
153 | Right right = new Right(); | 153 | Right right = new Right(); |
154 | right.setName("not-a-right"); | 154 | right.setName("not-a-right"); |
src/test/java/fr/plil/sio/persistence/jdbc/RightServiceTest.java
@@ -86,8 +86,8 @@ public class RightServiceTest extends AbstractServiceSupport { | @@ -86,8 +86,8 @@ public class RightServiceTest extends AbstractServiceSupport { | ||
86 | assertEquals(0, rightService.findByName("parent").size()); | 86 | assertEquals(0, rightService.findByName("parent").size()); |
87 | } | 87 | } |
88 | 88 | ||
89 | - @Test | ||
90 | - public void testDeleteRightIfNotFound() { | 89 | + @Test(expected = IllegalArgumentException.class) |
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 | assertFalse(rightService.delete(right)); |
src/test/java/fr/plil/sio/persistence/jdbc/UserServiceTest.java
@@ -70,6 +70,7 @@ public class UserServiceTest extends AbstractServiceSupport { | @@ -70,6 +70,7 @@ public class UserServiceTest extends AbstractServiceSupport { | ||
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,5 @@ logging.level.org.springframework=INFO | @@ -2,4 +2,5 @@ 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=500 | ||
6 | \ No newline at end of file | 5 | \ No newline at end of file |
6 | +spring.datasource.tomcat.max-active=500 | ||
7 | + |