Apprendre à développer les services REST avec Spring Boot et Spring RestTemplate,
Un tutoriel de Bertrand Nguimgo
Le 2018-02-22 22:11:54, par parchemal, Membre averti
Bonjour chers amis développeurs,
J'ai rédigé ce tutoriel qui permet d'apprendre à développer les services REST avec Spring Boot et Spring RestTemplate. L'idée dans ce tutoriel consiste à développer les services REST client/serveur dans deux applications distinctes et surtout à montrer qu'avec Spring Boot, le développeur ne passe plus trop du temps de la configuration de son projet, et peut ainsi déployer très facilement son application dans un environnement de développement comme dans un environnement de production.
Cet espace vous permet de donner votre point de vue et éventuellement une autre façon de répondre au même besoin. Votre participation est très attendue.
Merci d'avance
Bertrand Nguimgo
Retrouvez les meilleurs cours et tutoriels pour apprendre Spring
J'ai rédigé ce tutoriel qui permet d'apprendre à développer les services REST avec Spring Boot et Spring RestTemplate. L'idée dans ce tutoriel consiste à développer les services REST client/serveur dans deux applications distinctes et surtout à montrer qu'avec Spring Boot, le développeur ne passe plus trop du temps de la configuration de son projet, et peut ainsi déployer très facilement son application dans un environnement de développement comme dans un environnement de production.
Cet espace vous permet de donner votre point de vue et éventuellement une autre façon de répondre au même besoin. Votre participation est très attendue.
Merci d'avance
Bertrand Nguimgo
-
eulboboMembre chevronnéLe plus simple :
- Aller sur github : github.com
- Se créer un compte
- Créer un repository public (c'est gratuit tant que c'est public)
- Suivre les instruction pour pousser du code sur le repo
- Donner l'URL aux gens
Hésite pas à demander si tu as besoin d'aide, mais franchement le plus dur est de comprendre la finesse et la puissance de git, pas de créer un repo ou de partager du code :ple 08/03/2018 à 16:55 -
jeffray03Membre chevronnésalut,
le probleme est reglé,
c´etait juste une annotation qui a ete oublié sur :Code : 1
2
3
4@JsonIgnore public void setRoles(Set<Role> roles) { this.roles = roles; }
Code : 1
2
3
4@JsonIgnore public void setUsers(Set<User> users) { this.users = users; }
Je continue la mise en pratique et je reviens vers vous.
Ericle 11/05/2018 à 15:18 -
jeffray03Membre chevronnéSalut,
je ne vois pas ou est ce que tu as definis l´entite (classe) Role.
Dans les entités User et Role , il n´ya pas d´implementation de la classe Comparable a laquelle tu fais reference dans le controller Usercontroller.
Dans le Test:
Code : 1
2
3
4
5
6@Test public void testFindByLogin() { User userFromDB = userRepository.findByLogin("user2"); assertThat("user2", is(userFromDB.getLogin()));//user2 a été créé lors de l'initialisation du fichier data.sql }
Est ce un oublie?
Merci
Ericle 13/05/2018 à 14:43 -
vertex.3FMembre éclairébonjour,
petit a petit je continue avec ce tuto qui est vraiment riche. j'attaque les tests.
je vous fait part de la légère modification que j'ai effectuée dans les déclarations en haut de la classe de test UserServiceImplTest .
j'ai remplacé le pavé de code suivantCode : 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15@TestConfiguration //création des Beans nécessaires pour les tests static class UserServiceImplTestContextConfiguration { @Bean//bean de service public UserService userService () { return new UserServiceImpl(); } @Bean//nécessaire pour encrypter le mot de passe sinon échec des tests public BCryptPasswordEncoder passwordEncoder() { BCryptPasswordEncoder bCryptPasswordEncoder = new BCryptPasswordEncoder(); return bCryptPasswordEncoder; } }
Voici ce que ça donne :
(NB : version dans pom.xml : springboot 2.0.2)Code : 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33@RunWith(SpringRunner.class) @SpringBootTest public class UserServiceImplTest { private static Logger LOGGER = LoggerFactory.getLogger(UserServiceImplTest.class); @Autowired private UserService userService; @MockBean // création d'un mockBean pour UserRepository private UserRepository userRepository; @Test public void testGetAllUsers() { User user = new User("Dupont", "password", 1); Role role = new Role("USER_ROLE");// initialisation du role utilisateur Set<Role> roles = new HashSet<>(); roles.add(role); user.setRoles(roles); List<User> allUsers = Arrays.asList(user); Mockito.when(userRepository.findAll()).thenReturn(allUsers); Collection<User> users = userService.getAllUsers(); assertNotNull(users); assertEquals(users, allUsers); assertEquals(users.size(), allUsers.size()); Mockito.verify(userRepository).findAll(); } ... }
merci
bonne journéele 21/06/2018 à 17:42 -
momjuniorMembre actifOk je viens de comprendre, c'est le fichier application-dev-properties qui est chargé en production grâce à cette ligne:
Code : spring.profiles.active=dev
le 30/05/2019 à 21:42 -
momjuniorMembre actifBonjour
Pour les sources, regarde au niveau de:I. Première partie : Le serveurI-A. IntroductionToutes les sources (client et serveur) sont disponibles en téléchargementle 29/07/2019 à 12:14 -
atha2Membre éprouvéBonjour et merci pour ce tutoriel très complet.
Une question, dans la partie I-B-1-b. Structure de l'application, on est d'accord qu'on présente d'abord le setup d'un application jar et ensuite le setup d'une application war ?le 30/10/2019 à 23:56 -
momjuniorMembre actifBonjour
Il me semble qu'il y ait des problèmes de compatibilité concernant la méthode findOne et delete qui se trouvent dans UserController.java.
Dans le service User, la méthode findOne(Long) n'est plus disponible et j'ai lu dans les commentaires du tuto qu'il fallait la remplacer par findById et la signature devient "Optional<User> getUserById(Long id) throws BusinessResourceException;". Et ça marche.
Maintenant dans la Class UserController.java , je suis obligé de changer :Code : User userToUpdate = userService.getUserById(id);
Code : Optional<User> userToUpdate = userService.getUserById(id);
The method getRoles() is undefined for the type Optional<User>
Ensuite concernant la méthode delete:Code : 1
2
3
4
5
6
7
8
9@Override @Transactional(readOnly=false) public void deleteUser(Long id) throws BusinessResourceException { try{ userRepository.delete(id); }catch(Exception ex){ throw new BusinessResourceException("Delete User Error", "Erreur de suppression de l'utilisateur avec l'identifiant: "+id, HttpStatus.INTERNAL_SERVER_ERROR); } }
The method delete(User) in the type CrudRepository<User,Long> is not applicable for the arguments (Long)
Mercile 27/01/2020 à 17:12 -
parchemalMembre avertiBonjour à tous les lecteurs,
Une nouvelle version du tutoriel Apprendre à développer les services REST avec Spring Boot et Spring RestTemplate est en cours d'écriture.
Principales nouveautés:- Prise en compte de la dernière version stable de spring boot-2.2.4.RELEASE
- Mise à jour des packages et méthodes du projet suite aux évolutions liées à spring boot
- Amélioration des tests unitaires et des tests d'intégration suite aux remarques des lecteurs
- Amélioration de la gestion des exceptions
- Retrait du code métier dans les contrôleurs pour les mettre dans la partie service
- Ajout du plugin cargo-maven2-plugin pour démarrer et arrêter Tomcat9xx lors des tests d'intégration
- Ajout du profile pour déploiement automatique de l'application
- Mise à jour de l'IHM en mode responsive design
- Changement de commandName par modelAttribute (nouvelle recommandation de Spring pour la classe FormTag) dans les formulaires
- Etc.
Cordialement
Bertrand Nguimgole 18/02/2020 à 17:50 -
jerome villiseckCandidat au ClubBonjour, après avoir cherché un moment, je viens de trouver pourquoi le lancement des tests avec la commande
Code : mvn clean install -PintegrationTest
Il faut mettre dans la classe UserControllerIntegrationTest en value de l'annotation @SpringBootTest la valeur suivante DEFINED_PORT :
Code : 1
2
3
4
5
6
7
8
9
10
11
12
13@RunWith(SpringRunner.class) @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT) //Mettre DEFINED_PORT pour avoir le port 8080 pour les TI //Lors du lancement de la commande mvn clean install -PintegrationTest, fera les tests d'integration continue sur le port 8080 public class UserControllerIntegrationTest { //En cas de lancement manuel des tests avec l'IDE, lancer l'application spring au préalable comme pour les TU @Autowired private TestRestTemplate restTemplate; //dépendance nécessaire pour écrire les requêtes HTTP. private static final String URL = "http://localhost:8080";//url du serveur REST. Cet url peut être celle d'un serveur distant private String getURLWithPort(String uri) { return URL + uri; }
Code : Tomcat initialized with port(s): 8080 (http)
Le tomcat embedded démarre sur le port 8484, mais les appels sur ce port échouent. Grâce à la valeur DEFINED_PORT, et en faisant les appels sur le port 8080 dans les tests d'intégration, les tests d'intégration fonctionnent.Code x : 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by com.google.inject.internal.cglib.core.$ReflectUtils$1 (file:/usr/share/maven/lib/guice.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) WARNING: Please consider reporting this to the maintainers of com.google.inject.internal.cglib.core.$ReflectUtils$1 WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations WARNING: All illegal access operations will be denied in a future release [INFO] Scanning for projects... [INFO] [INFO] -----------------< fr.jerome:springboot-restserverapi >----------------- [INFO] Building springboot-restserverapi 0.0.1-SNAPSHOT [INFO] --------------------------------[ war ]--------------------------------- [INFO] [INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) @ springboot-restserverapi --- [INFO] Deleting /home/jerome/IdeaProjects/springboot-restserverapi/target [INFO] [INFO] --- maven-resources-plugin:3.1.0:resources (default-resources) @ springboot-restserverapi --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Copying 4 resources [INFO] [INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ springboot-restserverapi --- [INFO] Changes detected - recompiling the module! [INFO] Compiling 20 source files to /home/jerome/IdeaProjects/springboot-restserverapi/target/classes [INFO] [INFO] --- maven-resources-plugin:3.1.0:testResources (default-testResources) @ springboot-restserverapi --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] skip non existing resourceDirectory /home/jerome/IdeaProjects/springboot-restserverapi/src/test/resources [INFO] [INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ springboot-restserverapi --- [INFO] Changes detected - recompiling the module! [INFO] Compiling 5 source files to /home/jerome/IdeaProjects/springboot-restserverapi/target/test-classes [INFO] /home/jerome/IdeaProjects/springboot-restserverapi/src/test/java/fr/jerome/springbootrestserverapi/controller/UserControllerTest.java: /home/jerome/IdeaProjects/springboot-restserverapi/src/test/java/fr/jerome/springbootrestserverapi/controller/UserControllerTest.java uses or overrides a deprecated API. [INFO] /home/jerome/IdeaProjects/springboot-restserverapi/src/test/java/fr/jerome/springbootrestserverapi/controller/UserControllerTest.java: Recompile with -Xlint:deprecation for details. [INFO] [INFO] --- maven-surefire-plugin:2.22.2:test (default-test) @ springboot-restserverapi --- [INFO] Tests are skipped. [INFO] [INFO] --- maven-war-plugin:3.2.3:war (default-war) @ springboot-restserverapi --- [INFO] Packaging webapp [INFO] Assembling webapp [springboot-restserverapi] in [/home/jerome/IdeaProjects/springboot-restserverapi/target/springboot-restserver] [INFO] Processing war project [INFO] Webapp assembled in [125 msecs] [INFO] Building war: /home/jerome/IdeaProjects/springboot-restserverapi/target/springboot-restserver.war [INFO] [INFO] --- spring-boot-maven-plugin:2.2.6.RELEASE:repackage (repackage) @ springboot-restserverapi --- [INFO] Replacing main artifact with repackaged archive [INFO] [INFO] --- cargo-maven2-plugin:1.7.10:start (start-server) @ springboot-restserverapi --- [INFO] [2.ContainerStartMojo] Resolved container artifact org.codehaus.cargo:cargo-core-container-tomcat:jar:1.7.10 for container tomcat9x [INFO] [beddedLocalContainer] Tomcat 9.x Embedded starting... avr. 02, 2020 10:19:33 AM org.apache.coyote.AbstractProtocol init INFOS: Initializing ProtocolHandler ["http-nio-8484"] avr. 02, 2020 10:19:33 AM org.apache.catalina.core.StandardService startInternal INFOS: Starting service [Tomcat] avr. 02, 2020 10:19:33 AM org.apache.catalina.core.StandardEngine startInternal INFOS: Starting Servlet engine: [Apache Tomcat/9.0.30] avr. 02, 2020 10:19:33 AM org.apache.coyote.AbstractProtocol start INFOS: Starting ProtocolHandler ["http-nio-8484"] avr. 02, 2020 10:19:34 AM org.apache.catalina.startup.ContextConfig getDefaultWebXmlFragment INFOS: No global web.xml found avr. 02, 2020 10:19:36 AM org.apache.catalina.core.ApplicationContext log INFOS: 2 Spring WebApplicationInitializers detected on classpath . ____ _ __ _ _ /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ \\/ ___)| |_)| | | | | || (_| | ) ) ) ) ' |____| .__|_| |_|_| |_\__, | / / / / =========|_|==============|___/=/_/_/_/ :: Spring Boot :: (v2.2.6.RELEASE) 2020-04-02 10:19:37 - Starting ServletInitializer v0.0.1-SNAPSHOT on jerome-HP-ProBook-640-G1 with PID 12132 (/home/jerome/IdeaProjects/springboot-restserverapi/target/cargo/configurations/tomcat9x/webapps/springboot-restserver/WEB-INF/classes started by jerome in /home/jerome/IdeaProjects/springboot-restserverapi) 2020-04-02 10:19:37 - Running with Spring Boot v2.2.6.RELEASE, Spring v5.2.5.RELEASE 2020-04-02 10:19:37 - The following profiles are active: prod 2020-04-02 10:19:38 - Bootstrapping Spring Data JPA repositories in DEFAULT mode. 2020-04-02 10:19:38 - Finished Spring Data repository scanning in 77ms. Found 2 JPA repository interfaces. 2020-04-02 10:19:39 - Initializing Spring embedded WebApplicationContext 2020-04-02 10:19:39 - Published root WebApplicationContext as ServletContext attribute with name [org.springframework.web.context.WebApplicationContext.ROOT] 2020-04-02 10:19:39 - Root WebApplicationContext: initialization completed in 1445 ms 2020-04-02 10:19:39 - HikariPool-1 - Starting... 2020-04-02 10:19:39 - HikariPool-1 - Start completed. 2020-04-02 10:19:39 - H2 console available at '/console'. Database available at 'jdbc:h2:mem:testdb' 2020-04-02 10:19:39 - HHH000204: Processing PersistenceUnitInfo [name: default] 2020-04-02 10:19:40 - HHH000412: Hibernate ORM core version 5.4.12.Final 2020-04-02 10:19:40 - HCANN000001: Hibernate Commons Annotations {5.1.0.Final} 2020-04-02 10:19:40 - HHH000400: Using dialect: org.hibernate.dialect.H2Dialect 2020-04-02 10:19:41 - HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform] 2020-04-02 10:19:41 - Initialized JPA EntityManagerFactory for persistence unit 'default' 2020-04-02 10:19:42 - spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning 2020-04-02 10:19:42 - Initializing ExecutorService 'applicationTaskExecutor' 2020-04-02 10:19:42 - ControllerAdvice beans: 1 @ModelAttribute, 1 @InitBinder, 1 RequestBodyAdvice, 1 ResponseBodyAdvice 2020-04-02 10:19:43 - 8 mappings in 'requestMappingHandlerMapping' 2020-04-02 10:19:43 - Patterns [/webjars/**, /**] in 'resourceHandlerMapping' 2020-04-02 10:19:43 - ControllerAdvice beans: 1 @ExceptionHandler, 1 ResponseBodyAdvice 2020-04-02 10:19:43 - Started ServletInitializer in 6.35 seconds (JVM running for 18.325) 2020-04-02 10:19:43 - At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time. 2020-04-02 10:19:43 - Filter 'crossDomainFilter' configured for use [INFO] [beddedLocalContainer] Tomcat 9.x Embedded started on port [8484] [INFO] [INFO] --- maven-failsafe-plugin:2.22.2:integration-test (default) @ springboot-restserverapi --- [INFO] [INFO] ------------------------------------------------------- [INFO] T E S T S [INFO] ------------------------------------------------------- 10:19:44.738 [main] DEBUG org.springframework.test.context.junit4.SpringJUnit4ClassRunner - SpringJUnit4ClassRunner constructor called with [class fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest] 10:19:44.742 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating CacheAwareContextLoaderDelegate from class [org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate] 10:19:44.747 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating BootstrapContext using constructor [public org.springframework.test.context.support.DefaultBootstrapContext(java.lang.Class,org.springframework.test.context.CacheAwareContextLoaderDelegate)] 10:19:44.787 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating TestContextBootstrapper for test class [fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest] from class [org.springframework.boot.test.context.SpringBootTestContextBootstrapper] 10:19:44.800 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Neither @ContextConfiguration nor @ContextHierarchy found for test class [fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest], using SpringBootContextLoader 10:19:44.805 [main] DEBUG org.springframework.test.context.support.AbstractContextLoader - Did not detect default resource location for test class [fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest]: class path resource [fr/jerome/springbootrestserverapi/controller/UserControllerIntegrationTest-context.xml] does not exist 10:19:44.807 [main] DEBUG org.springframework.test.context.support.AbstractContextLoader - Did not detect default resource location for test class [fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest]: class path resource [fr/jerome/springbootrestserverapi/controller/UserControllerIntegrationTestContext.groovy] does not exist 10:19:44.807 [main] INFO org.springframework.test.context.support.AbstractContextLoader - Could not detect default resource locations for test class [fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest]: no resource found for suffixes {-context.xml, Context.groovy}. 10:19:44.808 [main] INFO org.springframework.test.context.support.AnnotationConfigContextLoaderUtils - Could not detect default configuration classes for test class [fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest]: UserControllerIntegrationTest does not declare any static, non-private, non-final, nested classes annotated with @Configuration. 10:19:44.848 [main] DEBUG org.springframework.test.context.support.ActiveProfilesUtils - Could not find an 'annotation declaring class' for annotation type [org.springframework.test.context.ActiveProfiles] and class [fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest] 10:19:44.953 [main] DEBUG org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider - Identified candidate component class: file [/home/jerome/IdeaProjects/springboot-restserverapi/target/classes/fr/jerome/springbootrestserverapi/SpringbootRestserverapiApplication.class] 10:19:44.954 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Found @SpringBootConfiguration fr.jerome.springbootrestserverapi.SpringbootRestserverapiApplication for test class fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest 10:19:45.034 [main] DEBUG org.springframework.boot.test.context.SpringBootTestContextBootstrapper - @TestExecutionListeners is not present for class [fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest]: using defaults. 10:19:45.035 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Loaded default TestExecutionListener class names from location [META-INF/spring.factories]: [org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener, org.springframework.test.context.web.ServletTestExecutionListener, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener, org.springframework.test.context.support.DependencyInjectionTestExecutionListener, org.springframework.test.context.support.DirtiesContextTestExecutionListener, org.springframework.test.context.transaction.TransactionalTestExecutionListener, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener, org.springframework.test.context.event.EventPublishingTestExecutionListener] 10:19:45.054 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Using TestExecutionListeners: [org.springframework.test.context.web.ServletTestExecutionListener@39b43d60, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener@44be0077, org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener@2205a05d, org.springframework.boot.test.autoconfigure.SpringBootDependencyInjectionTestExecutionListener@72ef8d15, org.springframework.test.context.support.DirtiesContextTestExecutionListener@6aa8e115, org.springframework.test.context.transaction.TransactionalTestExecutionListener@5e21e98f, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener@51a9ad5e, org.springframework.test.context.event.EventPublishingTestExecutionListener@5f20155b, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener@72ade7e3, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener@239105a8, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener@3fce8fd9, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener@609bcfb6, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener@7d94beb9] 10:19:45.058 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest] 10:19:45.059 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest] 10:19:45.093 [main] DEBUG org.springframework.test.context.junit4.SpringJUnit4ClassRunner - SpringJUnit4ClassRunner constructor called with [class fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest] 10:19:45.094 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating CacheAwareContextLoaderDelegate from class [org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate] 10:19:45.094 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating BootstrapContext using constructor [public org.springframework.test.context.support.DefaultBootstrapContext(java.lang.Class,org.springframework.test.context.CacheAwareContextLoaderDelegate)] 10:19:45.094 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating TestContextBootstrapper for test class [fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest] from class [org.springframework.boot.test.context.SpringBootTestContextBootstrapper] 10:19:45.095 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Neither @ContextConfiguration nor @ContextHierarchy found for test class [fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest], using SpringBootContextLoader 10:19:45.096 [main] DEBUG org.springframework.test.context.support.AbstractContextLoader - Did not detect default resource location for test class [fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest]: class path resource [fr/jerome/springbootrestserverapi/controller/UserControllerIntegrationTest-context.xml] does not exist 10:19:45.097 [main] DEBUG org.springframework.test.context.support.AbstractContextLoader - Did not detect default resource location for test class [fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest]: class path resource [fr/jerome/springbootrestserverapi/controller/UserControllerIntegrationTestContext.groovy] does not exist 10:19:45.097 [main] INFO org.springframework.test.context.support.AbstractContextLoader - Could not detect default resource locations for test class [fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest]: no resource found for suffixes {-context.xml, Context.groovy}. 10:19:45.097 [main] INFO org.springframework.test.context.support.AnnotationConfigContextLoaderUtils - Could not detect default configuration classes for test class [fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest]: UserControllerIntegrationTest does not declare any static, non-private, non-final, nested classes annotated with @Configuration. 10:19:45.100 [main] DEBUG org.springframework.test.context.support.ActiveProfilesUtils - Could not find an 'annotation declaring class' for annotation type [org.springframework.test.context.ActiveProfiles] and class [fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest] 10:19:45.101 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Found @SpringBootConfiguration fr.jerome.springbootrestserverapi.SpringbootRestserverapiApplication for test class fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest 10:19:45.103 [main] DEBUG org.springframework.boot.test.context.SpringBootTestContextBootstrapper - @TestExecutionListeners is not present for class [fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest]: using defaults. 10:19:45.103 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Loaded default TestExecutionListener class names from location [META-INF/spring.factories]: [org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener, org.springframework.test.context.web.ServletTestExecutionListener, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener, org.springframework.test.context.support.DependencyInjectionTestExecutionListener, org.springframework.test.context.support.DirtiesContextTestExecutionListener, org.springframework.test.context.transaction.TransactionalTestExecutionListener, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener, org.springframework.test.context.event.EventPublishingTestExecutionListener] 10:19:45.104 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Using TestExecutionListeners: [org.springframework.test.context.web.ServletTestExecutionListener@5b3f61ff, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener@3e2059ae, org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener@398dada8, org.springframework.boot.test.autoconfigure.SpringBootDependencyInjectionTestExecutionListener@7cb502c, org.springframework.test.context.support.DirtiesContextTestExecutionListener@275bf9b3, org.springframework.test.context.transaction.TransactionalTestExecutionListener@1b8a29df, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener@4fbe37eb, org.springframework.test.context.event.EventPublishingTestExecutionListener@12a94400, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener@6a47b187, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener@2049a9c1, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener@1ef6d34c, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener@46271dd6, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener@11bb571c] 10:19:45.104 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest] 10:19:45.105 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest] 10:19:45.184 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest] 10:19:45.184 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest] [INFO] Running fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest 10:19:45.198 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest] 10:19:45.198 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest] 10:19:45.199 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest] 10:19:45.200 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest] 10:19:45.204 [main] DEBUG org.springframework.test.context.support.AbstractDirtiesContextTestExecutionListener - Before test class: context [DefaultTestContext@c9d0d6 testClass = UserControllerIntegrationTest, testInstance = [null], testMethod = [null], testException = [null], mergedContextConfiguration = [WebMergedContextConfiguration@6ccdb29f testClass = UserControllerIntegrationTest, locations = '{}', classes = '{class fr.jerome.springbootrestserverapi.SpringbootRestserverapiApplication}', contextInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true}', contextCustomizers = set[org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer@776aec5c, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer@75d4a5c2, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer@0, org.springframework.boot.test.web.client.TestRestTemplateContextCustomizer@44c03695, org.springframework.boot.test.autoconfigure.properties.PropertyMappingContextCustomizer@0, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverContextCustomizerFactory$Customizer@3bf7ca37], resourceBasePath = 'src/main/webapp', contextLoader = 'org.springframework.boot.test.context.SpringBootContextLoader', parent = [null]], attributes = map['org.springframework.test.context.web.ServletTestExecutionListener.activateListener' -> false]], class annotated with @DirtiesContext [false] with mode [null]. 10:19:45.208 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest] 10:19:45.208 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest] 10:19:45.213 [main] DEBUG org.springframework.test.context.support.DependencyInjectionTestExecutionListener - Performing dependency injection for test context [[DefaultTestContext@c9d0d6 testClass = UserControllerIntegrationTest, testInstance = fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest@7ae42ce3, testMethod = [null], testException = [null], mergedContextConfiguration = [WebMergedContextConfiguration@6ccdb29f testClass = UserControllerIntegrationTest, locations = '{}', classes = '{class fr.jerome.springbootrestserverapi.SpringbootRestserverapiApplication}', contextInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true}', contextCustomizers = set[org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer@776aec5c, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer@75d4a5c2, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer@0, org.springframework.boot.test.web.client.TestRestTemplateContextCustomizer@44c03695, org.springframework.boot.test.autoconfigure.properties.PropertyMappingContextCustomizer@0, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverContextCustomizerFactory$Customizer@3bf7ca37], resourceBasePath = 'src/main/webapp', contextLoader = 'org.springframework.boot.test.context.SpringBootContextLoader', parent = [null]], attributes = map['org.springframework.test.context.web.ServletTestExecutionListener.activateListener' -> false]]]. 10:19:45.240 [main] DEBUG org.springframework.test.context.support.TestPropertySourceUtils - Adding inlined properties to environment: {spring.jmx.enabled=false, org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true} . ____ _ __ _ _ /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ \\/ ___)| |_)| | | | | || (_| | ) ) ) ) ' |____| .__|_| |_|_| |_\__, | / / / / =========|_|==============|___/=/_/_/_/ :: Spring Boot :: (v2.2.6.RELEASE) 2020-04-02 10:19:45 - Starting UserControllerIntegrationTest on jerome-HP-ProBook-640-G1 with PID 12230 (started by jerome in /home/jerome/IdeaProjects/springboot-restserverapi) 2020-04-02 10:19:45 - Running with Spring Boot v2.2.6.RELEASE, Spring v5.2.5.RELEASE 2020-04-02 10:19:45 - The following profiles are active: prod 2020-04-02 10:19:46 - Bootstrapping Spring Data JPA repositories in DEFAULT mode. 2020-04-02 10:19:46 - Finished Spring Data repository scanning in 64ms. Found 2 JPA repository interfaces. 2020-04-02 10:19:47 - Tomcat initialized with port(s): 8080 (http) 2020-04-02 10:19:47 - Starting service [Tomcat] 2020-04-02 10:19:47 - Starting Servlet engine: [Apache Tomcat/9.0.24] 2020-04-02 10:19:47 - Initializing Spring embedded WebApplicationContext 2020-04-02 10:19:47 - Published root WebApplicationContext as ServletContext attribute with name [org.springframework.web.context.WebApplicationContext.ROOT] 2020-04-02 10:19:47 - Root WebApplicationContext: initialization completed in 1633 ms 2020-04-02 10:19:47 - HikariPool-1 - Starting... 2020-04-02 10:19:47 - HikariPool-1 - Start completed. 2020-04-02 10:19:47 - H2 console available at '/console'. Database available at 'jdbc:h2:mem:testdb' 2020-04-02 10:19:47 - Filter 'crossDomainFilter' configured for use 2020-04-02 10:19:47 - HHH000204: Processing PersistenceUnitInfo [name: default] 2020-04-02 10:19:47 - HHH000412: Hibernate ORM core version 5.4.12.Final 2020-04-02 10:19:48 - HCANN000001: Hibernate Commons Annotations {5.1.0.Final} 2020-04-02 10:19:48 - HHH000400: Using dialect: org.hibernate.dialect.H2Dialect 2020-04-02 10:19:48 - HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform] 2020-04-02 10:19:48 - Initialized JPA EntityManagerFactory for persistence unit 'default' 2020-04-02 10:19:49 - spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning 2020-04-02 10:19:49 - Initializing ExecutorService 'applicationTaskExecutor' 2020-04-02 10:19:49 - ControllerAdvice beans: 1 @ModelAttribute, 1 @InitBinder, 1 RequestBodyAdvice, 1 ResponseBodyAdvice 2020-04-02 10:19:49 - 8 mappings in 'requestMappingHandlerMapping' 2020-04-02 10:19:49 - Patterns [/webjars/**, /**] in 'resourceHandlerMapping' 2020-04-02 10:19:49 - ControllerAdvice beans: 1 @ExceptionHandler, 1 ResponseBodyAdvice 2020-04-02 10:19:50 - Tomcat started on port(s): 8080 (http) with context path '' 2020-04-02 10:19:50 - Started UserControllerIntegrationTest in 4.916 seconds (JVM running for 6.426) 2020-04-02 10:19:50 - HTTP POST http://localhost:8080/user/users 2020-04-02 10:19:50 - Accept=[application/json, application/xml, application/*+json, text/xml, application/*+xml] 2020-04-02 10:19:50 - Writing [User [id=null, login=PIPO, pass=XXXX-XXX, active=1, roles=[]]] with org.springframework.http.converter.json.MappingJackson2HttpMessageConverter 2020-04-02 10:19:50 - Initializing Spring DispatcherServlet 'dispatcherServlet' 2020-04-02 10:19:50 - Initializing Servlet 'dispatcherServlet' 2020-04-02 10:19:50 - Detected StandardServletMultipartResolver 2020-04-02 10:19:50 - enableLoggingRequestDetails='true': request parameters and headers will be shown which may lead to unsafe logging of potentially sensitive data 2020-04-02 10:19:50 - Completed initialization in 19 ms 2020-04-02 10:19:50 - POST "/user/users", parameters={} 2020-04-02 10:19:50 - Mapped to fr.jerome.springbootrestserverapi.controller.UserController#saveUser(User) 2020-04-02 10:19:50 - Read "application/json;charset=UTF-8" to [User [id=null, login=PIPO, pass=XXXX-XXX, active=1, roles=[]]] 2020-04-02 10:19:50 - userSave: User [id=4, login=PIPO, pass=XXXX-XXX, active=0, roles=[Role{id=2, roleName='ROLE_USER'}]] 2020-04-02 10:19:50 - Using 'application/json', given [application/json, application/xml, application/*+json, text/xml, application/*+xml] and supported [application/json, application/*+json, application/json, application/*+json, application/xml, text/xml, application/*+xml] 2020-04-02 10:19:50 - Writing [User [id=4, login=PIPO, pass=XXXX-XXX, active=0, roles=[Role{id=2, roleName='ROLE_USER'}]]] 2020-04-02 10:19:50 - Response 201 CREATED 2020-04-02 10:19:50 - Reading to [fr.jerome.springbootrestserverapi.model.User] 2020-04-02 10:19:50 - Completed 201 CREATED 2020-04-02 10:19:50 - HTTP GET http://localhost:8080/user/users 2020-04-02 10:19:50 - Accept=[application/json, application/*+json] 2020-04-02 10:19:50 - GET "/user/users", parameters={} 2020-04-02 10:19:50 - Mapped to fr.jerome.springbootrestserverapi.controller.UserController#getAllUsers() 2020-04-02 10:19:50 - liste des utilisateurs : [User [id=1, login=admin, pass=XXXX-XXX, active=1, roles=[Role{id=1, roleName='ROLE_ADMIN'}, Role{id=2, roleName='ROLE_USER'}]], User [id=2, login=user, pass=XXXX-XXX, active=1, roles=[Role{id=2, roleName='ROLE_USER'}]], User [id=3, login=user1, pass=XXXX-XXX, active=0, roles=[Role{id=2, roleName='ROLE_USER'}]], User [id=4, login=PIPO, pass=XXXX-XXX, active=0, roles=[Role{id=2, roleName='ROLE_USER'}]]] 2020-04-02 10:19:50 - Using 'application/json', given [application/json, application/*+json] and supported [application/json, application/*+json, application/json, application/*+json] 2020-04-02 10:19:50 - Writing [[User [id=1, login=admin, pass=XXXX-XXX, active=1, roles=[Role{id=1, roleName='ROLE_ADMIN'}, Role{id (truncated)...] 2020-04-02 10:19:50 - Response 302 FOUND 2020-04-02 10:19:50 - Reading to [java.lang.Object] 2020-04-02 10:19:50 - HTTP POST http://localhost:8080/user/users 2020-04-02 10:19:50 - Accept=[application/json, application/xml, application/*+json, text/xml, application/*+xml] 2020-04-02 10:19:50 - Writing [User [id=null, login=login3, pass=XXXX-XXX, active=1, roles=[]]] with org.springframework.http.converter.json.MappingJackson2HttpMessageConverter 2020-04-02 10:19:50 - POST "/user/users", parameters={} 2020-04-02 10:19:50 - Mapped to fr.jerome.springbootrestserverapi.controller.UserController#saveUser(User) 2020-04-02 10:19:50 - Read "application/json;charset=UTF-8" to [User [id=null, login=login3, pass=XXXX-XXX, active=1, roles=[]]] 2020-04-02 10:19:50 - Completed 302 FOUND 2020-04-02 10:19:50 - userSave: User [id=5, login=login3, pass=XXXX-XXX, active=0, roles=[Role{id=2, roleName='ROLE_USER'}]] 2020-04-02 10:19:50 - Using 'application/json', given [application/json, application/xml, application/*+json, text/xml, application/*+xml] and supported [application/json, application/*+json, application/json, application/*+json, application/xml, text/xml, application/*+xml] 2020-04-02 10:19:50 - Writing [User [id=5, login=login3, pass=XXXX-XXX, active=0, roles=[Role{id=2, roleName='ROLE_USER'}]]] 2020-04-02 10:19:50 - Response 201 CREATED 2020-04-02 10:19:50 - Reading to [fr.jerome.springbootrestserverapi.model.User] 2020-04-02 10:19:50 - HTTP PUT http://localhost:8080/user/users/4 2020-04-02 10:19:50 - Accept=[application/json, application/xml, application/*+json, text/xml, application/*+xml] 2020-04-02 10:19:50 - Writing [User [id=5, login=newLogin, pass=XXXX-XXX, active=1, roles=[Role{id=0, roleName='ROLE_ADMIN'}, Role{id=2, roleName='ROLE_USER'}]]] with org.springframework.http.converter.json.MappingJackson2HttpMessageConverter 2020-04-02 10:19:50 - PUT "/user/users/4", parameters={} 2020-04-02 10:19:50 - Mapped to fr.jerome.springbootrestserverapi.controller.UserController#updateUser(Long, User) 2020-04-02 10:19:50 - Read "application/json;charset=UTF-8" to [User [id=5, login=newLogin, pass=XXXX-XXX, active=1, roles=[Role{id=0, roleName='ROLE_ADMIN'}, Role{ (truncated)...] 2020-04-02 10:19:50 - Completed 201 CREATED 2020-04-02 10:19:50 - UPDATE ROLE: [Role{id=2, roleName='ROLE_USER'}] 2020-04-02 10:19:50 - Using 'application/json', given [application/json, application/xml, application/*+json, text/xml, application/*+xml] and supported [application/json, application/*+json, application/json, application/*+json, application/xml, text/xml, application/*+xml] 2020-04-02 10:19:50 - Writing [User [id=4, login=newLogin, pass=XXXX-XXX, active=1, roles=[Role{id=2, roleName='ROLE_USER'}]]] 2020-04-02 10:19:50 - Response 200 OK 2020-04-02 10:19:50 - Reading to [fr.jerome.springbootrestserverapi.model.User] 2020-04-02 10:19:50 - HTTP GET http://localhost:8080/user/users/unknowUser 2020-04-02 10:19:50 - Accept=[application/json, application/xml, application/*+json, text/xml, application/*+xml] 2020-04-02 10:19:50 - GET "/user/users/unknowUser", parameters={} 2020-04-02 10:19:50 - Mapped to fr.jerome.springbootrestserverapi.controller.UserController#findUserByLogin(String) 2020-04-02 10:19:50 - Completed 200 OK 2020-04-02 10:19:50 - Using @ExceptionHandler fr.jerome.springbootrestserverapi.exception.GlobalHandlerControllerException#resourceNotFound(HttpServletRequest, BusinessResourceException) 2020-04-02 10:19:50 - Using 'application/json', given [application/json, application/xml, application/*+json, text/xml, application/*+xml] and supported [application/json, application/*+json, application/json, application/*+json] 2020-04-02 10:19:50 - Writing [fr.jerome.springbootrestserverapi.exception.BusinessResourceExceptionResponse@63060233] 2020-04-02 10:19:50 - Resolved [fr.jerome.springbootrestserverapi.exception.BusinessResourceException: L'utilisateur avec ce login n'existe pas :unknowUser] 2020-04-02 10:19:50 - Completed 204 NO_CONTENT 2020-04-02 10:19:50 - Response 204 NO_CONTENT 2020-04-02 10:19:50 - HTTP DELETE http://localhost:8080/user/users/2 2020-04-02 10:19:50 - Accept=[application/json, application/*+json] 2020-04-02 10:19:50 - DELETE "/user/users/2", parameters={} 2020-04-02 10:19:50 - Mapped to fr.jerome.springbootrestserverapi.controller.UserController#deleteUser(Long) 2020-04-02 10:19:50 - Using 'application/json', given [application/json, application/*+json] and supported [application/json, application/*+json, application/json, application/*+json] 2020-04-02 10:19:50 - Nothing to write: null body 2020-04-02 10:19:50 - Completed 410 GONE 2020-04-02 10:19:50 - Response 410 GONE 2020-04-02 10:19:50 - HTTP POST http://localhost:8080/user/users 2020-04-02 10:19:50 - Accept=[application/json, application/xml, application/*+json, text/xml, application/*+xml] 2020-04-02 10:19:50 - Writing [User [id=null, login=admin@admin.com, pass=XXXX-XXX, active=1, roles=[]]] with org.springframework.http.converter.json.MappingJackson2HttpMessageConverter 2020-04-02 10:19:50 - POST "/user/users", parameters={} 2020-04-02 10:19:50 - Mapped to fr.jerome.springbootrestserverapi.controller.UserController#saveUser(User) 2020-04-02 10:19:50 - Read "application/json;charset=UTF-8" to [User [id=null, login=admin@admin.com, pass=XXXX-XXX, active=1, roles=[]]] 2020-04-02 10:19:50 - userSave: User [id=6, login=admin@admin.com, pass=XXXX-XXX, active=0, roles=[Role{id=2, roleName='ROLE_USER'}]] 2020-04-02 10:19:50 - Using 'application/json', given [application/json, application/xml, application/*+json, text/xml, application/*+xml] and supported [application/json, application/*+json, application/json, application/*+json, application/xml, text/xml, application/*+xml] 2020-04-02 10:19:50 - Writing [User [id=6, login=admin@admin.com, pass=XXXX-XXX, active=0, roles=[Role{id=2, roleName='ROLE_USER'}] (truncated)...] 2020-04-02 10:19:50 - Completed 201 CREATED 2020-04-02 10:19:50 - Response 201 CREATED 2020-04-02 10:19:50 - Reading to [fr.jerome.springbootrestserverapi.model.User] 2020-04-02 10:19:50 - HTTP GET http://localhost:8080/user/users/admin@admin.com 2020-04-02 10:19:50 - Accept=[application/json, application/xml, application/*+json, text/xml, application/*+xml] 2020-04-02 10:19:50 - GET "/user/users/admin@admin.com", parameters={} 2020-04-02 10:19:50 - Mapped to fr.jerome.springbootrestserverapi.controller.UserController#findUserByLogin(String) 2020-04-02 10:19:50 - Utilisateur trouvé: User [id=6, login=admin@admin.com, pass=XXXX-XXX, active=0, roles=[Role{id=2, roleName='ROLE_USER'}]] 2020-04-02 10:19:50 - Using 'application/json', given [application/json, application/xml, application/*+json, text/xml, application/*+xml] and supported [application/json, application/*+json, application/json, application/*+json, application/xml, text/xml, application/*+xml] 2020-04-02 10:19:50 - Writing [User [id=6, login=admin@admin.com, pass=XXXX-XXX, active=0, roles=[Role{id=2, roleName='ROLE_USER'}] (truncated)...] 2020-04-02 10:19:50 - Response 302 FOUND 2020-04-02 10:19:50 - Reading to [fr.jerome.springbootrestserverapi.model.User] 2020-04-02 10:19:50 - Completed 302 FOUND [INFO] Tests run: 6, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 5.808 s - in fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest 2020-04-02 10:19:51 - Shutting down ExecutorService 'applicationTaskExecutor' 2020-04-02 10:19:51 - Closing JPA EntityManagerFactory for persistence unit 'default' 2020-04-02 10:19:51 - HHH000477: Starting delayed evictData of schema as part of SessionFactory shut-down' 2020-04-02 10:19:51 - HHH000478: Unsuccessful: drop table role if exists 2020-04-02 10:19:51 - HikariPool-1 - Shutdown initiated... 2020-04-02 10:19:51 - HikariPool-1 - Shutdown completed. [INFO] [INFO] Results: [INFO] [INFO] Tests run: 6, Failures: 0, Errors: 0, Skipped: 0 [INFO] [INFO] [INFO] --- maven-failsafe-plugin:2.22.2:verify (default) @ springboot-restserverapi --- [INFO] [INFO] --- cargo-maven2-plugin:1.7.10:stop (stop-server) @ springboot-restserverapi --- [INFO] [beddedLocalContainer] Tomcat 9.x Embedded is stopping... 2020-04-02 10:19:51 - Stopping service [Tomcat] 2020-04-02 10:19:51 - Closing Spring root WebApplicationContext 2020-04-02 10:19:51 - Shutting down ExecutorService 'applicationTaskExecutor' 2020-04-02 10:19:51 - Closing JPA EntityManagerFactory for persistence unit 'default' 2020-04-02 10:19:51 - HHH000477: Starting delayed evictData of schema as part of SessionFactory shut-down' 2020-04-02 10:19:51 - HHH000478: Unsuccessful: drop table role if exists 2020-04-02 10:19:51 - HikariPool-1 - Shutdown initiated... 2020-04-02 10:19:51 - HikariPool-1 - Shutdown completed. [INFO] [beddedLocalContainer] Tomcat 9.x Embedded is stopped [INFO] [INFO] --- maven-install-plugin:2.5.2:install (default-install) @ springboot-restserverapi --- [INFO] Installing /home/jerome/IdeaProjects/springboot-restserverapi/target/springboot-restserver.war to /home/jerome/.m2/repository/fr/jerome/springboot-restserverapi/0.0.1-SNAPSHOT/springboot-restserverapi-0.0.1-SNAPSHOT.war [INFO] Installing /home/jerome/IdeaProjects/springboot-restserverapi/pom.xml to /home/jerome/.m2/repository/fr/jerome/springboot-restserverapi/0.0.1-SNAPSHOT/springboot-restserverapi-0.0.1-SNAPSHOT.pom [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 30.575 s [INFO] Finished at: 2020-04-02T10:19:56+02:00 [INFO] ------------------------------------------------------------------------
Bien sur il faudra penser avant de lancer une compilation à arrêter le lancement de l'application en local. Egalement pour lancer les tests d'intégration depuis la classe directement
Mais cela ne pose pas de problème du coup pour les outils d'intégration continue et de déploiement type jenkins.
Si vous pouvez mettre une petite note dans le cours en ce sens ce serait cool.
Bonne journéele 02/04/2020 à 10:25